Reputation: 5143
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!
Upvotes: 0
Views: 1382
Reputation: 5143
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.
To add custom dimension:
Admin --> under "Property" column - Custom Defintions --> Custom dimension.
Each custom dimension has a scope - I used Hit-Level scope.
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.
Upvotes: 0
Reputation: 1158
This is something that custom dimensions could help with.
First of all, make sure you have user analysis set to 'on' in your google analytics settings, and set up tracking for users. You will then set the user id when the session starts like so:
ga('set', 'userId', 'my_user_id_123');
For company of the user, you will want to send a custom dimension. First, set up the custom dimension in the account settings. Then, just make another set call similar to how you identify the user in step 1:
ga('set', 'company', 'AwesomeCompanyId');
For clock-in and section, I think the event category / action / label should be enough to track what you need. I would suggest category: 'clockin'
action: 'clock-in'
label: 'section A'
ga('send', 'event', ‘clock-in’, ‘clock-in’, ‘section A’);```
You can then start using custom dimension vs custom event reports to answer the questions you have.
Upvotes: 3