Is it possible to change default name of page view event tracked after importing Angulartics2GoogleTagManager in app.component? Rigth now its Page View and I need to change the name.
Asked
Active
Viewed 461 times
1 Answers
2
If you want to change the name of the event, you would need to modify the angulartic2 GTM package itself. Specifically this file: https://github.com/angulartics/angulartics2/blob/master/src/lib/providers/gtm/gtm.ts
The datalayer.push for angulartics2.pageTrack
looks like this:
dataLayer.push({
'event': 'Page View',
'content-name': path,
'userId': this.angulartics2.settings.gtm.userId
});
If you want to change it, just change the 'event' key value.
To track pageviews however:
You need to:
- create a GTM custom event trigger for the "Page View" event
- create a GTM datalayer variable to capture the "content-name" value
- create a GTM tag for Google Analytics with the custom fields "page" set to the datalayer variable created in step 2 and trigger on the trigger created on step 1

XTOTHEL
- 5,098
- 1
- 9
- 17
-
Thanks for the great lead I think this is exactly it. Thank you – Piotr Smyda Nov 21 '18 at 08:40