Preparing your Google Analytics 4 Account for Multitouch Attribution

ga4 multi touch 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:

  1. Setting up a client_id for users on the Google Tag Manager (GTM) side.
  2. And adding custom dimensions.

We will cover all these steps now, but 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 in Google Analytics 4: Configuration tag type, if you don’t we create this tag at step 2.

 

Requirements

Setup before reading:

  • Google Analytics 4 (with data stream activated)
  • Google Tag Manager account with admin rights(!)

 

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. To do this, you need to open your GTM container here: https://tagmanager.google.com

  2. Add Click Add to workspace for  GTAG GET API
  3. Now in Tag Manager, 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. Go back to Tag Manager and add a Google Tag
    As Tag ID you’ll need the same ID which you used in the previous step in the Measurement ID input field. In the case of our screenshot we use a variable, yours might look different. The default format is similar to this G-XXXXXX.Then, open

    Advanced Settings -> Tag Sequencing. Set this tag to fire after the “save clientid” tag that we created earlier. Set the firing trigger to All Pages Page view. 

    Your tag should look similar to the screenshot below:

    If you want you can of course also set the save_clientid tag as Cleanup Tag for an existing Google Tag which fires on every page.Don’t forget to click “Save” to apply these changes.

  6. Next, we need to create Custom Event trigger: “gtagApiGet” event and set up the necessary Data Variables
  7. To do this, go to the “Triggers” section in GTM.
  8. Then, click “New”.
  9. Add a new trigger and name it “gtagApiGet”. Set the trigger type to “Custom Event”.
  10. Now, let’s add the necessary “Variables”. Go to the “Variables” section in GTM.
  11. Here, we only need to add one variable for the client ID. You just simply click “New” to create a new variable.
    Create new GTM variable
  12. 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
  13. Finally, click “Save” to save all the changes you’ve made.
  14. 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:Measurement ID (how to get it in step 4) Tag type: Google Analytics: GA4 EventConfiguration Tag: Google Analytics GA4 ConfigurationEvent Name: fetch_user_dataUnder User Properties

    Property Name: custom_client_id

    Value: {{gtagApiResult.client_id}}.

    IMPORTANT: don’t miss the dot at the end of the value

    Firing Triggers: here we need to set our gtagApiGet that we set before.
    then just click  “Save”.

  15. After that, click on the “Preview” button in the upper right corner of the GTM interface.
  16. There you enter your site address and navigate to a few pages to check if the “gtagApiGet” function was fired and if the client_id is in the correct location.
  17. Now after you made all these changes go to the main menu and click on “Submit”

    here you need to name these changes, let’s use  “windsor.ai ga4 attribution setup” and click “Publish”
    publish GTM changes
  18. If you want to test your GTM setup you can do it in two ways:
    1. You can use “Preview” as we did in step 7, but this time you need to check that “fetch_user_data” was triggered and have client_id as we saw it in step 8.
    2. You can use the Debugger tool. You can find instructions on using it under the app screenshots on the debugger 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 a field from our `fetch_user_data` that we created at 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. You can also add “sessions” metric to be able to see the number of sessions by client_id.
    NOTE: you won’t be able to see client_id instantly because GA4 need some time to gather them, we recommend checking them in 24h.
  7. From there, you should be able to see the custom dimensions you added and use them to explore your data. 

Up next here are the instructions on how to proceed with the setup on Windsor.ai:

Setting up Google Analytics 4 (GA4) Multitouch Attribution with Windsor.ai is simple and can be done by following these easy steps:

  1. Go to onboard.windsor.ai and log in to your account. Register one if you don’t have one. 
  2. Select the Google Analytics 4 (App+Web) data source and sign in to your GA4 account using your Google credentials. Provide Windsor.ai with all the necessary permissions.
  3. Select the GA4 accounts that you want to use for Multitouch Attribution.

  4. Check the checkbox to use GA4 Multitouch Attribution. After this, a field will appear where you need to enter the name of the client ID Custom Dimension that you set in GA4 during the first step of the guide. Then click “Add”. NOTE: if you refresh the page you will see the“customuser_” was attached to the name of custom_client_id. This is expected behavior and you don’t need to change it back just leave it as it is.onboard add client id
  5. Go to the data preview page.
    onboard data preview
  6. On the data preview page, select one of the desired Multitouch Attribution dashboards: ROAS or CPA.

  7. We will ask you to enter your Windsor.ai account password, which will also be used to access your dashboard in the future on charts.windsor.ai.

  8. Wait a few minutes while we create your dashboard.
  9. Once the dashboard is ready, click on the hyperlink to view it.

  10. Congratulations! Your dashboard is now available at https://charts.windsor.ai and can be accessed using your Windsor.ai login and password. Please note that the data on the dashboard will be updated once a day at 01:00.
  11. Here you can read how to increase Marketing ROI with our Multi-touch Attribution Modelling Software.