mzuccaroli / angular-google-tag-manager

A service library for integrate google tag manager in your angular project
https://itnext.io/how-to-add-google-tag-manager-to-an-angular-application-fc68624386e2
MIT License
136 stars 78 forks source link

Clear the dataLayer #176

Closed YouZag closed 1 year ago

YouZag commented 1 year ago

I've tried to create a fork - but am failing to make it build properly. So, I'm resorting to creating a feature request here...

The items array pushes to the array. However, on new page views, I'd like to refresh that array and push new items to it on an event.

Does this sound correct? If so, my feature request would be to add a function to clearDataLayer() and be able to fire a fresh event without appending to the same items array.

mzuccaroli commented 1 year ago

I think this is not correct , gtm use a single instance of the datalayer for each session an you can push new events/pageviews on it