Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Angular's $location object is sent to analytics for every page track #117

Open
henrahmagix opened this issue Oct 1, 2018 · 1 comment
Open

Comments

@henrahmagix
Copy link

henrahmagix commented Oct 1, 2018

The second argument to the pageTrack method of Angulartics is the $location object seen here:
https://github.com/angulartics/angulartics/blob/80325aa938dfbbe95b2e1287767d6e47294935bf/src/angulartics.js#L306

which results in multiple extra fields being sent to ga() due to extending the object here:

dispatchToGa('pageview', 'send', angular.extend(angular.copy(properties), {
hitType: 'pageview',
page: path
}));

The following is logged to the console when using the Google Analytics Debugger extension for Chrome:

Executing Google Analytics commands.
analytics_debug.js:17 Running command: ga("send", {$$protocol: "http", $$host: "localhost", $$port: 80, $$parse: [function], $$compose: [function], $$parseLinkUrl: [function], $$path: "", $$search: {}, $$hash: "", $$url: "", $$absUrl: "http://localhost/foo", $$state: null, $$replace: true, hitType: "pageview", page: ""})
analytics_debug.js:17 Set called on unknown field: "$$protocol".
analytics_debug.js:17 Set called on unknown field: "$$host".
analytics_debug.js:17 Set called on unknown field: "$$port".
analytics_debug.js:17 Set called on unknown field: "$$parse".
analytics_debug.js:17 Set called on unknown field: "$$compose".
analytics_debug.js:17 Set called on unknown field: "$$parseLinkUrl".
analytics_debug.js:17 Set called on unknown field: "$$path".
analytics_debug.js:17 Set called on unknown field: "$$search".
analytics_debug.js:17 Set called on unknown field: "$$hash".
analytics_debug.js:17 Set called on unknown field: "$$url".
analytics_debug.js:17 Set called on unknown field: "$$absUrl".
analytics_debug.js:17 Set called on unknown field: "$$state".
analytics_debug.js:17 Set called on unknown field: "$$replace".
analytics_debug.js:17 Setting throttling cookie: "_gat"
analytics_debug.js:17 
Sent beacon:
<output specific to my project>
@henrahmagix
Copy link
Author

I'm not sure if this means those extra fields are being sent to Google or not, and whether that's ok or not, but I feel like it's a bug.

I'm also not sure of the intent of Angulartics pageTrack specific method, so I can't be sure that this library shouldn't be extending properties. I would submit a pull-request but I don't feel familiar enough with this project, sorry =)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant