bgarret / google-analytics-rails Goto Github PK
View Code? Open in Web Editor NEWRails 3 helpers to manage google analytics tracking. Mostly intended for small to medium websites.
Rails 3 helpers to manage google analytics tracking. Mostly intended for small to medium websites.
Directives like _setDomainName or _setAllowLinker should be placed before any _trackXxx directive in order to let GA being properly configured (cookie, etc.) before pushing data to google servers.
_gaq.push(['_setAccount','UA-X-Y']);
_gaq.push(['_trackPageview']);
_gaq.push(['_setDomainName','none']);
_gaq.push(['_setAllowLinker',true]);
Repro:
GA::Event.new('send', 'evt', "foo'sbar")
Expected:
ga('send','evt','foo\'sbar')
Actual:
ga('send','evt','foo'sbar')
This causes the page to stop executing JS
Hey thanks so much for this nice little Gem! I was wondering if you could help me with this, I want to see the demographics tab on GA but its directs me to the following link:
https://support.google.com/analytics/answer/2444872?hl=en&utm_id=ad
Says I need to edit the script to this:
<script type="text/javascript"> var _gaq = _gaq || []; _gaq.push(['_setAccount', 'UA-xxxxx-y']); _gaq.push(['_trackPageview']); (function() { var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true; ga.src = ('https:' == document.location.protocol ? 'https://' : 'http://') + 'stats.g.doubleclick.net/dc.js'; var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s); })(); </script>Any way you can help direct me how to edit that?
Thanks for your help!
Adam
Any chance of releasing the latest version of google-analytics-rails to RubyGems? In particular it'd be great to see the enhanced link attribute #14 in the released gem.
First noticed this when deploying my app to heroku, but looks like google-analytics-rails breaks the production environment in a relatively vanilla Rails 3.2.3 app.
I have followed the instructions and set the GA.tracker in environment files development.rb and production.rb. Somehow the latter breaks. Any idea what's going on?
☁ xxx [master] ⚡ rails console
Loading development environment (Rails 3.2.3)
1.9.3p194 :001 > GA
=> GoogleAnalytics
1.9.3p194 :002 > exit
☁ xxx [master] ⚡ RAILS_ENV=production rails console
/Users/pirkka/Sites/xxx/config/environments/production.rb:70:in `block in <top (required)>': uninitialized constant GA (NameError)
from /Users/pirkka/.rvm/gems/ruby-1.9.3-p194@ohh/gems/railties-3.2.3/lib/rails/railtie/configurable.rb:24:in `class_eval'
from /Users/pirkka/.rvm/gems/ruby-1.9.3-p194@ohh/gems/railties-3.2.3/lib/rails/railtie/configurable.rb:24:in `configure'
from /Users/pirkka/Sites/ohh/config/environments/production.rb:1:in `<top (required)>'
環境によって、分岐できるようにはしている。
Are there any plans to support Google Analytics Cross-Domain Tracking?
There are some cases (especially in single page apps) where it is not desirable to automatically send a pageview
event at library initialization. For those cases, we need a way to suppress this event in analytics_init
.
Do you have any plans to support Turbolinks? like described here:
http://reed.github.io/turbolinks-compatibility/google_analytics.html
It looks like gtag.js
was released recently.
So, Do you have plans for supporting gatg.js
format ?
How/where would we add the ga('set', 'anonymizeIp', true);
from https://developers.google.com/analytics/devguides/collection/analyticsjs/field-reference#anonymizeIp to comply with GDPR?
Support for track userId.
ga('set', 'userId', 'USER_ID'); // Defina o ID de usuário usando o user_id conectado.
Should the new analytics.js from Google be supported? (without using GA.script_source): https://developers.google.com/analytics/devguides/collection/analyticsjs/advanced
Advanced Configuration - Web Tracking (analytics.js)
This document provides an overview of the analytics.js collection library.
The analytics.js snippet is part of Universal Analytics, which is currently in public beta. New users should use analytics.js. Existing ga.js users should create a new web property for analytics.js and dual tag their site. It is perfectly safe to include both ga.js and analytics.js snippets on the same page.
Tracking events from controller
class MyController < ApplicationController
def index
GA.track_event("MyEvent", "tag")
end
end
I found http://rubydoc.info/github/bgarret/google-analytics-rails/GoogleAnalytics/Rails/ViewHelpers#analytics_init-instance_method but to be honest I find it quite cryptic ;-)
For example:
:local (Boolean) — default: false — Sets the local development mode. See http://www.google.com/support/forum/p/Google%20Analytics/thread?tid=741739888e14c07a&hl=en
"Sets the local development mode" doesn't really mean anything, to me at least. And the thread referred to is quite long and equally confusing. Maybe I'm just stupid or lazy, but it would really be nice if there were a couple of sentences here explaining how this works. Is this really significantly different from the other suggested usage?
<%= analytics_init if Rails.env.production? %>
Thanks ...
Allows one to see separate information for multiple links on a page that all have the same destination.
https://support.google.com/analytics/bin/answer.py?hl=en&utm_id=ad&answer=2558867
Set using the same interface as the other init settings: analytics_init :enhanced_link_attribution => true
I have a Rails 5 application which serves only as an API provider and executes some background jobs.
I want to know if Google Analytics offers support for these kind of applications where there is no file like:
app/views/layout/application.html.erb
Where am I supposed to put this line of code in that case:
<%= analytics_init if GoogleAnalytics.valid_tracker? %>
Hi,
I've seen in your code that you support siteSpeedSampleRate. How do I configure it?
Cheers and thx!
The analytics_init
view helper is missing an option to add a _setDomainName
event before the first page view tracking.
Could you add a domain
option for this?
Thanks.
What's the best way to use the User Id feature from analytics with this gem?
https://developers.google.com/analytics/devguides/collection/analyticsjs/user-id
/Users/jpbadger/.rvm/gems/ree-1.8.7-2012.02@rvcportal23/gems/activesupport-2.3.14/lib/active_support/dependencies.rb:466:in `load_missing_constant': uninitialized constant Rails::Railtie (NameError)
Not too big of a deal, but it may be helpful to note in the README that the gem isn't compatible with Rails 2. Cheers.
Does this gem support https://developers.google.com/analytics/devguides/collection/analyticsjs/display-features?
Do you have any plans to support slim as template engine?
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.