Is there any way for Google Analytics to track multiple event parameters like Mixpanel?

后端 未结 4 932
[愿得一人]
[愿得一人] 2020-12-31 14:14

Given:

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

I tried with opt_label but it seems like it\'s just a string

4条回答
  •  粉色の甜心
    2020-12-31 14:23

    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

提交回复
热议问题