简体   繁体   中英

Google Analytics Custom variable is not working

I want to set the user details in Google analytics. I using the following syntax but it is not working to capture the use those who logged in an application.

ga('set', 'employeetype', 'permanent');
ga('set', 'employeetype', 'vendor');
ga('set', 'employeetype', 'temporary');

You need to send the number of the custom dimension that was set up in Google analytics

ga('set', 'dimension1', 'permanent');

You can't use the name you sent that is for you Google Analytics has no understanding of it. Make sure you check Google Analytics and get the correct number corresponding to employeetype dimension (dimensions are set via the "dimension" prefix and the numerical index from the list of dimensions in the GA backend - the index more or less shows the order in which dimensions are created).

Dimensions come in different "scopes" - hit level (ie they are connected to every single interaction), session level (ie they record only the last value set during a session) and user level (ie they are applied to a recurring visitor). Unless you expect your employees to change their type rather often you should probably set this to user level scope (but that's a backend setting, code is the same).

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM