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

Repair 'fix' for analytics scroll tracker non-interaction flag #429

Merged
merged 1 commit into from
Jun 30, 2014
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion app/assets/javascripts/analytics/scroll-tracker.js
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@
for ( var i=0; i<this.trackedNodes.length; i++ ) {
if ( this.trackedNodes[i].isVisible() && !this.trackedNodes[i].alreadySeen ) {
this.trackedNodes[i].alreadySeen = true;
GOVUK.sendToAnalytics(["_trackEvent"].concat(this.trackedNodes[i].eventData).concat([true]));
GOVUK.sendToAnalytics(["_trackEvent"].concat(this.trackedNodes[i].eventData).concat([0, true]));
// Last 'true' sets non-interaction flag
// https://developers.google.com/analytics/devguides/collection/gajs/eventTrackerGuide#non-interaction
}
Expand Down
8 changes: 4 additions & 4 deletions spec/javascripts/analytics/scroll-tracker-spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,8 @@ describe("GOVUK.ScrollTracker", function() {
scrollToPercent(60);

expect(GOVUK.sendToAnalytics.calls.count()).toBe(2);
expect(GOVUK.sendToAnalytics.calls.argsFor(0)).toEqual([ ["_trackEvent", "ScrollTo", "Percent", "25", true] ]);
expect(GOVUK.sendToAnalytics.calls.argsFor(1)).toEqual([ ["_trackEvent", "ScrollTo", "Percent", "50", true] ]);
expect(GOVUK.sendToAnalytics.calls.argsFor(0)).toEqual([ ["_trackEvent", "ScrollTo", "Percent", "25", 0, true] ]);
expect(GOVUK.sendToAnalytics.calls.argsFor(1)).toEqual([ ["_trackEvent", "ScrollTo", "Percent", "50", 0, true] ]);
});
});

Expand All @@ -71,7 +71,7 @@ describe("GOVUK.ScrollTracker", function() {
scrollToShowHeadingNumber(1);

expect(GOVUK.sendToAnalytics.calls.count()).toBe(1);
expect(GOVUK.sendToAnalytics.calls.argsFor(0)).toEqual([ ["_trackEvent", "ScrollTo", "Heading", "This is the first heading", true] ]);
expect(GOVUK.sendToAnalytics.calls.argsFor(0)).toEqual([ ["_trackEvent", "ScrollTo", "Heading", "This is the first heading", 0, true] ]);

scrollToShowHeadingNumber(2);

Expand All @@ -80,7 +80,7 @@ describe("GOVUK.ScrollTracker", function() {
scrollToShowHeadingNumber(3);

expect(GOVUK.sendToAnalytics.calls.count()).toBe(2);
expect(GOVUK.sendToAnalytics.calls.argsFor(1)).toEqual([ ["_trackEvent", "ScrollTo", "Heading", "This is the third heading", true] ]);
expect(GOVUK.sendToAnalytics.calls.argsFor(1)).toEqual([ ["_trackEvent", "ScrollTo", "Heading", "This is the third heading", 0, true] ]);
});
});

Expand Down