Search code examples
google-analyticsgoogle-analytics-api

Google Analytics - Events - Category, Action & Label are not enough


I would like to send event that includes all kind of parameters and then to be able to slice it in the UI for each parameter.

Currently AFAIK I got only three parameters: Category, Action & Label.

I develop a tracking time app and I want to send an event when a user clock in. So an example of event would be:
1. Company of user
2. User id
3. clock-in
4. Section inside the app the user clocked-in from

Eventually I would like to slice the data in Analytics UI in all kinds of way:
1. How many clock-ins per Company
2. How many clock-ins per User
3. How many clock-ins made from section1

How can I achieve that? Thanks!


Solution

  • In general the answer is custom dimenstions (Thanks @KatherineR).
    Category, Action & Label are dimensions and you have the ability to add dimensions of your own.

    1. To add custom dimension: Admin --> under "Property" column - Custom Defintions --> Custom dimension.
      Each custom dimension has a scope - I used Hit-Level scope.

    2. Code:

      ga('send', 'event', gaCategory, gaAction, gaLabel, {
          'dimension1': companyName,
          'dimension2': userId
      });
      

      Please note the keys should be dimensionN, where n=[1..9].
      the n is then index of the custom dimensions you defined in section 1.

    3. Now in GA ui you can create your new report which include your new custom dimensions. Customization --> Custom reports --> create new report In the "Report content" --> Dimenstions --> include your new dimensions.