Skip to content

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

@henrahmagix

Description

@henrahmagix

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>

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions