Search code examples
javascriptuniversal-analytics

GUA - Non Interaction for Dimensions


I am working on Google Universal Analytics and I see that our Dimensions are being captured by Google about 60% of the time. I see that the Dimensions are being set and I have verified in the Network that the Dimension is being sent to Google. Someone suggested that I look into setting {'nonInteract': 1}. I am confused where I should set the nonInteract flag to (ie - should I be setting this to GA() when I am setting the Dimension, or should it be set to the GA() when I am sending the event?

I have tried the following below, but I am confused with the result. In the Network tab, I do see that the Dimension is being sent to Google. When I inspect the Console with the GUA Debugger Tool, trying to set the dimension results in a Command ignored. Unknown target: undefined.

//Two variations I have tried when implementing the `nonInteraction` flag:

ga(u.name + '.send', 'event', category, action, label, {'nonInteraction': 1});
ga('set', 'dimension' + cvSlot, label, {'nonInteraction': 1});

Screenshot of console when cannot set Dimension15: enter image description here

Source of where I got the nonInteract code: https://developers.google.com/analytics/devguides/collection/analyticsjs/events

My question is how do I attach the nonInteraction flag to my Dimension?


Solution

  • Setting a non-interaction flag on a set call for a dimension would be pointless since the set call is not an interaction in the first place. An Interaction is a hit that sends information to the Google servers (send pageview, event, timing, ecommerce item and transactions). You need to have an interaction hit to send a custom dimension. The only hit type you can set to non-interactive is event. However a set call after an event is pointless since the hit has already been sent and the dimension cannot be added to the hit (and it might even be harmful, since a set call attaches the dimension to all subsequent hits, interactive or not).

    So the best way would be to use a non-interaction event and attach the dimension to it via it's configuration object.

    ga('send', 'event', 'category', 'action', {
      'nonInteraction': 1}
      'dimension': myvalue
    });
    

    Non-Interaction means that the event will not affect the bounce rate, so it's not like the setting will have a huge effect (it will only affect people who trigger an event on their first pageview and then leave without looking at more pages).