angulartics / angulartics-google-analytics

Google Analytics plugin for Angulartics
MIT License
133 stars 86 forks source link

exclude ids from URLs #78

Closed menocomp closed 7 years ago

menocomp commented 7 years ago

If I have two urls like: http://xyz/#/employee/150 http://xyz/#/employee/160 Google analytics treats them as two different page views. How can I exclude the ID part so that both urls are considered as one url? I am using this line of code in the controller: $analytics.pageTrack('http://xyz/#/employee'); and this actually fixed the issue because it override the default page url sent to google, but I am asking for a decent solution that keeps my angular controllers clean from any google analytics code?

DanWilkerson commented 7 years ago

You've basically got two options, as far as I can tell; both involve turning off auto pageview tracking. 1) Write your own auto-pageview tracking handler - here's some code you might use as a jumping off point: http://www.lunametrics.com/blog/2016/05/04/integrating-angularjs-google-tag-manager/ (or you can look at the angulartics source and start there) 2) Wire your router routes to include a route-specific handler for pageview tracking.

Sorry, there's nothing I can think of using Angulartics to solve this without your adding extra code. Closing.

timelf123 commented 7 years ago

related to https://github.com/angulartics/angulartics/issues/116