Given:
_trackEvent(category, action, opt_label, opt_value, opt_noninteraction)
I tried with opt_label but it seems like it\'s just a string
GA is not as good as Mixpanel for tracking event (or hit in general) properties, and maybe you should rethink what you want to/can do in GA. That said, there is a way to achieve what you need with custom dimensions and metrics. Here is some info on what they do, and here are instructions on how to set them up in the admin panel, and here you can find how to use them in your code. Some limitations:
There are 20 indices available for different custom dimensions and 20 indices for custom metrics in each property. 360 accounts have 200 indices available for custom dimensions and 200 for custom metrics.
Custom dimensions cannot be deleted, but you can disable them.
First, you would need to add the custom dimensions/metrics through the admin panel in GA (Admin -> Properties column -> Custom Definitions -> Custom Dimensions/Metrics).
Using analytics.js
, you can set the event properties using either set
before you trigger a hit, or send
when you trigger a hit. Examples:
// set the dimension/metric values before the hit
ga('set', {
'dimension5': 'custom dimension data',
'metric5': 8000
});
// values set above are passed to GA along with the hit info
ga('send', 'event', 'someCategory', 'someAction');
// or alternatively
ga('send', 'event', 'someCategory', 'someAction', {
'dimension5': 'custom dimension data',
'metric5': 8000
});
In case you're not sure what's the difference between dimensions and metrics, check this out.
I hope this helps