Search code examples
backbone.jsgoogle-analyticsmarionettegoogle-analytics-apigoogle-tag-manager

How to add Google Tag Manager firing rule for Backbone Marionette site?


I have already built a site with backbone marionette and now I am trying to use Google Tag manager to add the tracking. But I have no idea how to configure GTM, in order to listen page change and button click event.


Solution

  • Clicks are up to you to set up listening events and track manually from views. Page views can be tracked like this:

    Backbone.history.on('route', function() {
      // Send Backbone.history.fragment to your page view tracker
    });