Closed
Bug 972907
Opened 11 years ago
Closed 11 years ago
webmaker-analytics missing nonInteraction events if no value option is supplied
Categories
(Webmaker Graveyard :: Metrics, defect)
Tracking
(Not tracked)
RESOLVED
FIXED
People
(Reporter: thecount, Assigned: thecount)
Details
Attachments
(1 file)
Right now on popcorn.mofostaging.net, we're trying to track ended events as a nonInteraction event.
It fires the event fine, but we never see the results coming into the google analytics report page.
I think I know why.
If you look here: https://github.com/mozilla/webmaker-analytics/blob/master/analytics.js#L91-L96
You'll see that we're pushing the values, and nonInteraction needs to be the last, or 5th index argument. If no value is supplied, it becomes the 4th.
A value argument of true seems to not log the event, is my guess?
We should be putting these values into their right index instead of pushing, maybe.
So in the case of a nonInteraction with no value, we should be pushing something like this:
["_trackEvent", "popcorn.mofostaging.net", "Media Ended", "Editor", , true]
What we're doing now is:
["_trackEvent", "popcorn.mofostaging.net", "Media Ended", "Editor", true]
If I enter the bottom one directly into the console, I can confirm we never see the report, but the top one is fine.
| Assignee | ||
Updated•11 years ago
|
Assignee: nobody → scott
| Assignee | ||
Comment 1•11 years ago
|
||
Based on my debugger console tests, this is what it wants.
Tests added and passing.
Attachment #8376368 -
Flags: review?(david.humphrey)
| Assignee | ||
Updated•11 years ago
|
Summary: webmaker-analytics missing nonInteraction events if no value is supplied → webmaker-analytics missing nonInteraction events if no value option is supplied
Comment 2•11 years ago
|
||
I don't think this is right. The GA APIs are very specific about data type vs. argument position, so it shouldn't matter where the optional args go. Can you research a bit more?
Status: NEW → ASSIGNED
| Assignee | ||
Comment 3•11 years ago
|
||
Sure thing.
If you check in these:
https://developers.google.com/analytics/devguides/collection/gajs/eventTrackerGuide#Labels
https://developers.google.com/analytics/devguides/collection/gajs/eventTrackerGuide#Values
https://developers.google.com/analytics/devguides/collection/gajs/eventTrackerGuide#non-interaction
I specifically says third for Label, fourth for Values and final for non-interaction.
I tested it, and an event like this:
["_trackEvent", "popcorn.mofostaging.net", "Media Ended", "Editor", true]
Never gets logged, but this one does.
["_trackEvent", "popcorn.mofostaging.net", "Media Ended", "Editor", , true]
You can do this directly in your console on popcorn.mofostaging.net, and view it in GA's unfiltered realtime event report.
This is the hint that started me down this road: http://stackoverflow.com/questions/7922544/google-analytics-non-interaction-trackevent-not-firing
I am not seeing anything on type working regardless of order.
Also, if you look at the example here: http://analytics.blogspot.ca/2011/10/non-interaction-events-wait-what.html
You see they pass in a 1 as the value options to show how to use a non-interaction event.
Another one: https://productforums.google.com/forum/#!topic/analytics/TJ1MjlFO-Pw
Also in here: https://developers.google.com/analytics/devguides/collection/gajs/methods/gaJSApiEventTracking
You can see:
> You can use any of the following optional parameters: opt_label, opt_value or opt_noninteraction.
> If you want to provide a value only for the second or 3rd optional parameter, you need to pass in
> undefined for the preceding optional parameter.
Comment 4•11 years ago
|
||
Comment on attachment 8376368 [details] [review]
https://github.com/mozilla/webmaker-analytics/pull/2
I would like to see us test this live a bit on staging, since the unit tests don't interact with a real GA server; but this is probably right.
Adding Adam for a second set of eyes. It seems odd to me that we need to worry about position so much, given the reliance on typing in the API, but I guess Google isn't worried about doing a good API.
Attachment #8376368 -
Flags: review?(david.humphrey)
Attachment #8376368 -
Flags: review?(adam)
Attachment #8376368 -
Flags: review+
Comment 5•11 years ago
|
||
Comment on attachment 8376368 [details] [review]
https://github.com/mozilla/webmaker-analytics/pull/2
I think it's just the old version of the GA API that's so fussy about the order.
This change looks good to me and will be easy to check on staging before it goes to prod.
Attachment #8376368 -
Flags: review?(adam) → review+
| Assignee | ||
Comment 6•11 years ago
|
||
Staged: https://github.com/mozilla/webmaker-analytics/commit/e93125e9ca425a73744f4e6ee0430a7fa590d439
Status: ASSIGNED → RESOLVED
Closed: 11 years ago
Resolution: --- → FIXED
You need to log in
before you can comment on or make changes to this bug.
Description
•