GA Custom Dims

C code posted
created at 28 May 12:56

Edit | Back
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
/**
 * Note: User and Session-Level Scopes are Greedy
 * 
 * Custom dimension values with user or session-level scope will apply to all hits in the current session, including past hits. If you don't want a custom dimension value with session or user-level scope to be applied to past hits in the current session, start a new session before applying the value to a hit.
 * 
 * For example, if you're using membership type as a user-level custom dimension, and a user upgrades their membership in the middle of a session, you may want to start a new session before you set the new custom dimension value. This ensures that the hits prior to the upgrade will be associated with the old membership value, while new hits will be associated with the new value.
 * 
 */

#Define GA_DIM_GENDER 1
#Define GA_DIM_YEAR 2
#Define GA_DIM_USERTYPE 3
#Define GA_DIM_ACCOUNTSTATUS 4

[tracker setCustom:GA_DIM_GENDER        dimension:@"Male"];
[tracker setCustom:GA_DIM_YEAR          dimension:@"1987"];
[tracker setCustom:GA_DIM_USERTYPE      dimension:@"sponsored"];
[tracker setCustom:GA_DIM_ACCOUNTSTATUS dimension:@"Verified"];
1.11 KB in 2 ms with coderay