Preparing your Google Analytics 4 Account for Multitouch Attribution

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.


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.

  1. To get started, add this template from the GTM templates gallery. Just click “Add to workspace.”
  2. 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.

  3. Next, create a new tag and name it “save clientid” (or any name you prefer). Your screen should now look like this:
  4. 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.
  5. 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.
  6. After that, click on the “Preview” button located in the upper right corner of the GTM interface.

  7. 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.
  8. Next, we need to create Custom Event trigger: “gtagApiGet” event and set up the necessary Data Variables
  9. To do this, go to the “Triggers” section in GTM.
  10. Then, click “New”.
  11. Add a new trigger and name it “gtagApiGet”. Set the trigger type to “Custom Event”.
  12. Now, let’s add the necessary “Variables”. Go to the “Variables” section in GTM.
  13. 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.
  14. 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
  15. Finally, click “Save” to save all the changes you’ve made.
  16. 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

  17. 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).

  1. Open your admin panel in GA4.

  2. Then, open Custom Definitions.
  3. 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
  4. Now you can go to Explore -> Create blank report

  5. Click the “+” sign to add a new dimension

  6. 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.