Skip to content

Commit

Permalink
Trialling custom pageview tracking through Google Analytics
Browse files Browse the repository at this point in the history
  • Loading branch information
Andrew Cobby committed Oct 10, 2012
1 parent edac5a0 commit 4cef967
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
1 change: 0 additions & 1 deletion templates/index.twig
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@
var _gaq = _gaq || [];
_gaq.push(['_setAccount', 'UA-27879276-5']);
_gaq.push(['_trackPageview']);
{% if not app.debug %}
(function() {
Expand Down
7 changes: 6 additions & 1 deletion web/js/routers/AppRouter.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ TGM.Routers.AppRouter = Backbone.Router.extend({
this.models.activeBudget = this.models.userBudget;
TGM.vent.trigger('activeBudget', this.models.userBudget);
TGM.vent.trigger('showSidePane', 'budget-allocator');
_gaq.push(['_trackPageview']);
}
},

Expand All @@ -43,6 +44,7 @@ TGM.Routers.AppRouter = Backbone.Router.extend({
var fetchSuccess = _.bind(function() {
TGM.vent.trigger('activeBudget', this.models.activeBudget);
if (this.models.activeBudget != this.models.userBudget) {
_gaq.push(['_trackPageview']);
_gaq.push(['_trackEvent', 'Budget', 'View', this.models.activeBudget.id])
}
}, this);
Expand Down Expand Up @@ -78,16 +80,18 @@ TGM.Routers.AppRouter = Backbone.Router.extend({
this.models.activeBudget = this.models.userBudget;
TGM.vent.trigger('activeBudget', this.models.activeBudget);
TGM.vent.trigger('showSidePane', 'budget-allocator');
_gaq.push(['_trackPageview']);
}
},

saveBudget: function(id)
{
if (id && (this.models.userBudget.id != id || !$.jStorage.get('clientId'))) {
this.goto("budget", id);
return this.goto("budget", id);
}

TGM.vent.trigger('showSidePane', 'save-budget');
_gaq.push(['_trackPageview']);
},

viewBudgets: function()
Expand All @@ -112,6 +116,7 @@ TGM.Routers.AppRouter = Backbone.Router.extend({
}

TGM.vent.trigger('showSidePane', 'other-budgets');
_gaq.push(['_trackPageview']);
},

goto: function()
Expand Down

0 comments on commit 4cef967

Please sign in to comment.