Event tracking empty label string

I have a function that handles tracking the certian event, for example:

var trackAddress = function (providedProduct, searchedProduct) {
    _trackEvent('Address found', providedProduct, searchedProduct);
}

      

Now what if searchProduct is undefined or empty string?

The point is that in Google Analytics I see that the sum of all actions of an event is equal to the total number of events. This does not apply to event labels.

What could be causing this?

+3


source to share


1 answer


I'm sure you know this, but for the sake of argument, this is the anatomy of event tracking:

_trackEvent(category, action, opt_label, opt_value, opt_noninteraction)

      

  • category (required): The name you provide for the group of items you want to track.
  • action (required): A string that is uniquely associated with each category and is typically used to define the type of user interaction for a web object.
  • label (optional): An optional string to provide additional dimensions for event data.
  • value (optional): An integer that you can use to provide numeric data for a custom event.
  • non-interaction (optional): A Boolean value that, when set to true, indicates that the impact on the event will not be used in calculating the bounce rate.


Now, if in your case a required parameter is missing (for example, an action ), there should be a mechanism in Google Analytics that completely invalidates the event. Conversely, the optional parameter does not affect the event tracking, but rather the report. To summarize, the result is the same: Data loss .




Possible way to create default parameters for function arguments:

providedProduct = typeof a !== 'undefined' ? providedProduct : "defaultValue";

      


Further reading: Configuring event tracking

+2


source







All Articles