Google Tag Manager - override page-tracking.es6.js

Hello there :slight_smile:

I’m working with Google Tag Manager and there is something I don’t understand on your implementation:

When I load the first page, I have two events sent:

  • a « Page View » event;
  • a « VirtualPageView » event.
    Then, on all page changes:
  • a « VirtualPageView » event.
    Why are you sending two events on the first page load?

I tried to override your page-tracking.es6.js in the initializers folder by creating a plugin which includes the same file in assets/javascripts/initializers/ but this doesn’t work and your file is executed, not mine. Maybe I’m not doing things good to override one of initializers file. What should I do?

I don’t know what can I do to do that so if someone can help me… thanks :slight_smile:

Mathieu.

Have we tried this @neil?

I haven’t tried overriding page-tracking.js. I don’t think it’s as simple as putting your own file with the same name in a plugin.

Regarding the GTM tracking, I welcome any improvements from anyone who understands GTM better than me. Keep in mind that any changes must not break the universal analytics integration with GTM. I seem to remember the way it is now was to make sure analytics works via GTM.

2 Likes