Hello! Today, I’ll explain the steps you need to take in your Google Analytics 4 (GA4) account to prepare for attribution in Windsor AI.
Preparing for attribution involves two steps:
- Add a client_id for users on the Google Tag Manager (GTM) side.
- Add custom dimensions.
Before you get started, make sure you have set up GA4 with a data stream and have GTM installed. Also, make sure you’re using the standard connector between GA4 and GTM.
Requirements
Setup before reading
- Google Analytics 4 (with data stream activated)
- Google Tag Manager
NOTE: Make sure you are using the standard connector with GA4 for GTM.
Google Tag Manager (GTM Configuration)
Now, let’s set everything up in GTM.
- To get started, add this template from the GTM templates gallery. Just click “Add to workspace.”
- In your GTM tags, you should see the “Google Analytics: GA4 Configuration” tag. If you don’t have this tag yet, create a new tag and select “Google Analytics: GA4 Configuration” as the tag type. Make sure you’re using the same GTM container ID that’s connected to your GA4 property.
- Next, create a new tag and name it “save clientid” (or any name you prefer). Your screen should now look like this:
- Now you need to set the GA4 Measurement ID in the appropriate field.
Here’s how to find it:
– Go to your GA4 property and click on “Admin” at the bottom left.
– Under “Property”, click “Data streams”.
– Click on “Web”.
– Click on your web data stream name.
– Your measurement ID is located in the top right corner. Copy it and paste it into the appropriate field in GTM. - Good! Then you need to go to Google Analytics 4: Configuration. Now proceed to open Advanced Settings -> Tag Sequencing. Set this tag to fire after the “save clientid” tag that we created earlier:
Don’t forget to click “Save” to apply these changes. - After that, click on the “Preview” button located in the upper right corner of the GTM interface.
- Now, go to your site and navigate to a few pages to check if the “gtagApiGet” function was fired and the client_id is in the correct location.
- Next, we need to create Custom Event trigger: “gtagApiGet” event and set up the necessary Data Variables
- To do this, go to the “Triggers” section in GTM.
- Then, click “New”.
- Add a new trigger and name it “gtagApiGet”. Set the trigger type to “Custom Event”.
- Now, let’s add the necessary “Variables”. Go to the “Variables” section in GTM.
- Here, we only need to add one variable for the client ID. We already created it. You just simply click “New” to create a new variable.
- Next, fill in all the necessary fields with the following data:
Name(at the top): gtagApiResult.client_id
Variable Type: Data Layer Variable
Data Layer Variable Name: gtagApiResult.client_id
Data Layer Version: Version 2
- Finally, click “Save” to save all the changes you’ve made.
- The last step for GTM is to create a new Google Analytics 4 Event Tag. To do this, go to the “Tags” section, click “New”, and name the tag “fetch_user_data”. Fill in all the other fields with the following information:
Tag type: Google Analytics: GA4 Event
Configuration Tag: Google Analytics GA4 Configuration
Event Name: fetch_user_data
Under User Properties
Property Name: custom_client_id
Value: {{gtagApiResult.client_id}}.
IMPORTANT: don’t miss the dot at the end of value
Firing Triggers: here we need to set our gtagApiGet that we set before - To test your GTM setup, you can use the Debugger tool. You can find instructions on how to use it under the app screenshots on this page. When you run the Debugger on your site, you should be able to see the client ID that we set up earlier.
Google Analytics 4 (GA 4) Configuration
Now that all the settings in GTM are complete, we can move on to Google Analytics 4 (GA4).
- Open your admin panel in GA4.
- Then, open Custom Definitions.
- Click the Create custom dimensions button.
And here we need to add field from our `fetch_user_data` that we created in the end of GTM section.
Dimension name: custom_client_id
Scope: User
Description: client_id custom dimension
User property: custom_client_id
- Now you can go to Explore -> Create blank report
- Click the “+” sign to add a new dimension
- From there, you should be able to see the custom dimensions you added and use them to explore your data.
Congratulations! Now every user of your site will have their client ID, and you will be able to use Windsor AI to track the value and ROAS of every marketing touchpoint.
Here you can book a demo with us, and Here you can read how to increase Marketing ROI with our Multi-touch Attribution Modelling Software.