albertlyu / shot-charts-site

A Rails web application for visualizing NCAA men's basketball play-by-play shot location data
MIT License
3 stars 1 forks source link

Google Analytics tracking is not working #34

Closed albertlyu closed 10 years ago

albertlyu commented 10 years ago

I don't see any real-time updates with Google Analytics tracking after fixing #23. I'll open this issue to work on fixing tracking.

Review the following links as necessary: https://support.google.com/analytics/answer/1008080?hl=en&utm_id=ad http://railsapps.github.io/rails-google-analytics.html

Then check the 'Real-Time Overview' page to see live updates within seconds. Also check if "Status: Tracking Not Installed" has been updated on the 'Tracking Code' page under 'Tracking Info.'

albertlyu commented 10 years ago

As a note, after deployment to Heroku, run heroku run rake assets:precompile RAILS_ENV=production before checking if tracking is working.

albertlyu commented 10 years ago

Would deploying Segment.io be a good alternative? Or would the issue persist with Segment.io as well? Something to think about.

albertlyu commented 10 years ago

Some conflicting instructions: "Paste your snippet (unaltered, in it’s entirety) into every web page you want to track. Paste it immediately before the closing </head> tag." from https://support.google.com/analytics/answer/1008080?hl=en&utm_id=ad. But http://railsapps.github.io/rails-google-analytics.html suggests placing the script in the footer partial. Currently, it is deployed in the footer partial and viewing the page source shows that the script is on the page. It may be worthwhile to try placing it before the </head> tag instead and test that.

albertlyu commented 10 years ago

It doesn't appear that placing the script in the head tag works either (via 7a2052e32307dd6aef3ae6a37434b81e077aa227).

albertlyu commented 10 years ago

Maybe I should wait 24 hours before checking this again. We have the commit history as reference in case the tracking still doesn't work this time tomorrow.

albertlyu commented 10 years ago

I had to revert to a previous commit as the shot charts were broken. The code change that caused the Highcharts charts to not render was the ones to insert turbolinks erb tags in application.html.erb.

albertlyu commented 10 years ago

Status has now been changed to 'Receiving Data,' and I can confirm that new sessions on the site are appearing in Google Analytics. Closing issue.