Reputation: 166
I have a question regarding two seemingly different ways to implement sending an event in google analytics as a non-interaction hit type.
(1) Protocol docs: https://developers.google.com/analytics/devguides/collection/protocol/v1/parameters#ni
In query param:
&ni=1
/collect?v=1&t=event&ni=1
(2) Analytics dev guide: https://developers.google.com/analytics/devguides/collection/analyticsjs/events
ga('send', 'event', 'Videos', 'play', 'Fall Campaign', {
nonInteraction: true
});
which I inferred allows me to do this:
ga('send', {
hitType: 'event'
eventCategory: 'myCategory',
eventAction: 'myAction',
eventLabel: 'myLabel',
nonIteraction: true
});
However, when I look at the network traffic in the chrome browser dev console I do not see the "ni=1" url parameter. Here is a list of the parameters that are present (values excluded):
v: _v: a: t: _s: cd: dl: dp: ul: de: dt: sd: sr: vp: je: ec: ea: an: av: aid: aiid: _u: jid: gjid: cid: tid: _gid: z:
What is the difference betweeen these two implementations, and are the end results the same?
Upvotes: 1
Views: 2754
Reputation: 166
The answer to my original question: Yes - the end result of both implementations is the same. Both should include the "ni=1" url parameter.
If you do not see this in the dev console network traffic or in your server logs there is a mistake. In my case, my mistake is evident in my original post - notice the typo:
nonIteraction: true
should've been:
nonInteraction: true
Upvotes: 0
Reputation: 4151
I have both a server-side and JavaScript implementation of Google Analytics event tracking and in my experience they are treated exactly the same.
In my server-side implementation I send a payload directly to the /collect
location with query parameters exactly as you posted (including &ni=1
).
In JavaScript, I'm using the same syntax as you with {'nonInteraction': true}
as my fieldsObject. Seemingly the only difference is I put nonInteraction
in quotes (but I wouldn't think that would be enough to prevent it- worth a try).
I can see the ni=1
show up in my console when I use the Google Analytics debugger (here is part of the log):
And here it is in the Network tab itself:
I would double check that your t
parameter is in fact event
and double check that you're inspecting the correct one (maybe there is a chance you're looking at a different event)?
I'd also try installing the Google Analytics Debugger Chrome extension (even temporarily) for a more visual representation of each payload in the console.
Google Analytics does not treat those two methods you posted differently, so the ni
parameter should be in there if the event you're sending is in fact written as you posted. Maybe someone else can glean some additional ideas from what you posted, but to me it seems everything is properly implemented.
Upvotes: 1