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

**URL:** https://meta.discourse.org/t/google-tag-manager-override-page-tracking-es6-js/74521
**Category:** Development
**Created:** [11월 21, 2017, 4:11오후 UTC](https://meta.discourse.org/t/google-tag-manager-override-page-tracking-es6-js/74521 "2017-11-21T16:11:01Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![Mathieu](https://avatars.discourse-cdn.com/v4/letter/m/3be4f8/32.png) [@Mathieu](https://meta.discourse.org/u/Mathieu)
#### Post date: [11월 21, 2017, 4:11오후 UTC](https://meta.discourse.org/t/google-tag-manager-override-page-tracking-es6-js/74521/1 "2017-11-21T16:11:01Z")

</div>

Hello there 🙂

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 🙂

Mathieu.

---

<div class="post-metadata">

### Author: ![codinghorror](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/codinghorror/32/110067_2.png) [@codinghorror](https://meta.discourse.org/u/codinghorror)
#### Post date: [11월 21, 2017, 9:10오후 UTC](https://meta.discourse.org/t/google-tag-manager-override-page-tracking-es6-js/74521/2 "2017-11-21T21:10:27Z")

</div>

Have we tried this @neil?

---

<div class="post-metadata">

### Author: ![neil](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/neil/32/102150_2.png) [@neil](https://meta.discourse.org/u/neil)
#### Post date: [11월 21, 2017, 9:16오후 UTC](https://meta.discourse.org/t/google-tag-manager-override-page-tracking-es6-js/74521/3 "2017-11-21T21:16:43Z")

</div>

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.
