Skip to content

Instantly share code, notes, and snippets.

@fayimora
Forked from gpoitch/google_analytics_mixin.js
Created April 27, 2013 09:23
Show Gist options
  • Save fayimora/5472478 to your computer and use it in GitHub Desktop.
Save fayimora/5472478 to your computer and use it in GitHub Desktop.
Ember.GoogleAnalytics = Ember.Mixin.create({
trackPageView: function() {
if(!Ember.isNone(ga)) {
Ember.run.next(function() {
var loc = window.location,
page = loc.hash ? loc.hash.substring(1) : loc.pathname + loc.search;
ga('send', 'pageview', page);
});
}
}.observes('currentPath')
});
@fayimora
Copy link
Author

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment