This section introduces how to Set Client ID to User Properties in GA4, you can also replace Client ID with User ID, Page URL or others.
User Properties
User properties are attributes that describe groups of your user base, such as their language preferences or geographic locations. You can use user properties to define audiences.
Actually, User Properties is actually User Scope Custom Dimension.
Configuration
Next, demonstrate how to Set Client ID to User Properties in GA4.
Variable
In GTM, click 「Variables」——「New」——「Choose a variable type to begin setup…」——「1st Party Cookie」 then name it “Client ID“, and configure as follows:
The function of this configuration is to use the 1st Party Cookie Variables to obtain the Client ID in the cookie.
Tags
The next step is to set the Client ID as User Properties.
Open GA4‘s tag, and configure as follows in User Properties:
Note that this setting is in GA4‘s tag. The client_id on the left is the custom User Properties, and {{Client ID}} is the variable from the previous step.
Preview
The next step is to preview to see if the client_id can get the accurate Client ID.
Click 「Preview」in GTM:
Enter https://www.bbccss.com in Tag Assistant:
Uncheck “Include debug signal in the URL” and click “Connect”.
Enter the test state and return to Tag Assistant,Click 「Container Loaded」, then click GA4‘s Tag, click 「value」 in the upper right corner
You can see that client_id is the exact Client ID.
Custom definitions
Next, you need to register client_id as User Scope Custom Dimension in GA4, and then you can use it in GA4 reports.
Click「Admin」——「Custom definitions」——「Create custom dimension」in GA4, and then configure as follows:
Scope selects Users, indicating that it is User Scope Custom Dimension.