Valentin V
Valentin V

Reputation: 25739

Google Analytics non-interactive hit scope

I'm confused about the Google Universal analytics Non-Interaction hit scope. Docs don't say anything about it: https://developers.google.com/analytics/devguides/collection/analyticsjs/field-reference#nonInteraction

Is it working only for the next event or for the entire duration of the visit?

Should I set it back to false after the event is sent?

Currently I'm doing it as:

ga("set", "nonInteraction", true);
ga("send", "event", {..});

Upvotes: 0

Views: 818

Answers (1)

Eike Pierstorff
Eike Pierstorff

Reputation: 32760

If you set a field with the "set"-method it's valid for all subsequent calls on that page. I.e. It's not persistent and does not apply to the whole visits, but applies to all interactions after that call to set until a new page is loaded.

On the other hand if set the field in the configuration object (the json you can pass as parameter) for an interaction call it will work only for that call.

This is not specific to the noninteraction-flag.

You can pass the flag for a single call in different ways, e.g.

ga('send', 'event', 'Category', 'Action', {'nonInteraction': 1});

or

ga('send', {
  'hitType': 'event',          // Required.
  'eventCategory': 'Category',   // Required.
  'eventAction': 'Action',      // Required.
  'eventLabel': 'Label',
  'nonInteraction': 1
});

Upvotes: 2

Related Questions