In this section I will explain how to set up custom dimensions. Assume that we are setting the user dimension this time. We will put the user level information on the page in the form of JS variables, and then get it through the variable of Google Tag Manager to set it as the custom dimension.
1、Create a custom dimension in Google Analytics
Click “Admin”→ “Custom Definitions” → “Custom Dimension” → “+ New Custom Dimension” in Google Analytics, There is a scope here, including Hit, Session, User, and Product. This is a custom dimension that you want to pass. The user level is tied to the user, so it is the User level.
Specific settings such as:
and then write down its index value. This is the index value is 3. This index value will be used later.
2、Put user level information on the page
This requires development support. The user level information is put on the page in the following format:
<span style="font-size: 12pt;"><script> UserLevel="A"; </script> </span>
2、User variable to get user level information
3、Turn global variables into custom dimensions
In the Google Analytics default tracking code, we are here to set the basic tracking code through google analytics settings, so we need to configure in Google Analytics Settings:
Find the custom dimension in “More Settings” and configure it as shown:
Index is filled with the index we created in Google Analytics, and the value is the variable User Level. Then save it.
4、Preview and Publish
Click Preview in the upper right corner, and you can publish without any problems.
To use a custom dimension, you need to first determine the level of the custom dimension, whether it is Hit or Session, or User, Product, and the first three are generally used. The way to judge is to see how long this customization is the dimension life cycle before it changes.