angulartics / angulartics-google-analytics

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

Page is different for eventTrack vs pageTrack #82

Closed stefnoten closed 7 years ago

stefnoten commented 7 years ago

For a pageTrack, the url is generated in the following way: $analytics.settings.pageTracking.basePath + $location.url()

For an eventTrack however, the page url is generated in the following way: properties.page || window.location.hash.substring(1) || window.location.pathname

This yields different results for the same page in Google Analytics. Shouldn't they be generated in the same way?

DanWilkerson commented 7 years ago

Yes, you're correct - that should be standardized. I would prefer if we added a helper function to get that value consistently or moved into the dispatchToGa function.

DanWilkerson commented 7 years ago

@timelf123 thoughts here? We could look at something upstream, set a "global" when pageTrack is called, or just copy the logic used upstream into a helper within the plugin. I'd lean towards 1 or 2, in case upstream changes occur further down the line. I think 2 is appropriate, although a bit hackey. 1 seems like the best approach to me at first brush.

timelf123 commented 7 years ago

2 seems fine to me but I'm down to extend the current core API too