How to Store MSCLKID in Google Analytics 4

On This Page

    What is the MSCLKID? 

    MSCLKID is a parameter used for click tracking in Microsoft Ads ads. This parameter is sent to the ad redirect page by the browser of the user who clicked the ad, where a click tracking cookie is created. This cookie is then used to track actions taken after the user clicked on the ad. For example, if the user buys a product after clicking the ad, this purchase can be tracked by the tracking cookie.

    The MSCLKID parameter is an important tool for advertisers.Advertisers can track how effective their ads are and how many sales they make by using this parameter. This will help advertisers to make their advertising decisions more consciously and try to make their advertisements more effective.

    Why It’s Important to Store MSCLKID in Google Analytics 4 (GA4) ? 

    Storing the MSCLKID in GA4 is important because it allows you to track the effectiveness of your marketing campaigns and understand how users interact with your website. By linking clicks on your website to sessions in GA4, you can see how users are behaving on your website after they click on an ad or other marketing material. You can use Google Analytics 4 reports along with the MSCLKID and use it to make decisions about your advertising campaigns.

    In a previous article, we explained how to enable MSCLKID in Microsoft Ads using Auto-Tagging. If you haven’t done this yet, you can take a look at our post.

    How to Store MSCLKID in Google Analytics 4

    Using “Custom Definitions” and “Google Tag Manager”, you can easily store MSCLKID in Google Analytics 4. The first step for this process is to create a custom definition in Google Analytics 4 where you will store MSCLKIDs: 

    Create New Custom Definition on Google Analytics 4

    The first step to collect MSCLKID data in Google Analytics 4 is to create the necessary custom definitions. For this you can follow the steps below:

    1. Sign in to your Google Analytics account.
    2. Click the “Admin” button at the bottom of the left menu and switch to the Admin page.
    3. After selecting your relevant Account and Property, click “Custom Definitions” on the right panel.
    4. Click the “Create Custom Dimension” button in the “Custom Dimensions” tab.
    5. Fill in the “Dimension Name” field as “Microsoft Click ID”.
    6. Select “User” for “Event scope”.
    7. Fill in the “Description” field as you wish.
    8. Type “msclkid” in the “User property” field.

    Now you have created a custom definition for Google Analytics 4 and you are ready to continue with the next step. The next step will be to separate the MSCLKID parameter from the ad URLs and send it to Google Analytics 4. You will need to use Google Tag Manager (GTM) for this process.

    Create New Variable on Google Tag Manager (GTM) to Capture GCLID From URL

    When your visitors click on a Microsoft Ads ad, an “msclkid” parameter is automatically added to the end of your site address they’re visiting. Unfortunately, Google Analytics 4 cannot automatically store this parameter. It is necessary to separate this parameter from the URL and send it to Google Analytics 4 for storage with the help of GTM. The first thing to do for this is to separate this parameter from the URL and store it in a variable on GTM. You can follow the steps below to perform this operation.

    1. Log in to Google Tag Manager with the account you use your Google Analytics with.
    2. Switch to the “Variables” page by clicking the “Variables” button from the left menu.
    3. Click the “+New” button in the “User defined variables” section.
    4. Click on the “Variable Configuration” panel.
    5. Select “URL” as “Variable Type”.
    6. Select “Query” as “Component Type”.
    7. Type “msclkid” in the “Query Key” field.
    8. Save the variable you created by naming it as you want.

    GTM will separate the “msclkid” parameter from your incoming URLs and store it in this variable you just created. All you have to do is send it to Google Analytics 4 with GTM “Tag”.

    Create New Tag on Google Tag Manager to Send GCLID to Google Analytics 4

    In the previous step, you managed to separate the “msclkid” parameter from the site URL and store it in a variable. However, this data is still only available on the GTM. In this step, you will send this variable to Google Analytics 4 for storage.

    If you don’t have an Analytics Tag that you use to send your data to Google Analytics 4

    If you don’t have a “Google Analytics: GA4 Configuration” tag, you need to create it first. You can follow the steps below for this.

    1. Go to the “Tags” page by clicking the “Tags” button from the left menu.
    2. Create a new tag by clicking the “New” button.
    3. Click on the “Tag Configuration” panel.
    4. Select “Google Analytics: GA4 Configuration” as “Tag Type”.
    5. In the “Measurement ID” section, write your Measurement ID of your Google Analytics 4 property. If you do not know your Measurement ID, you can get more information from this page.
    6. Click the “User Properties” section and click the “Add Row” button.
    7. Type “msclkid” in the “Property Name” field. This is the custom dimension you created in the previous steps.
    8. Click on the “Value” field and select the GTM variable you created in the previous step.
    9. Click on the “Triggering” section and choose a trigger that will meet your needs. For example “All Pages”
    10. Save your new tag by naming it as you wish.

    If you already have an Analytics Tag that you use to send your data to Google Analytics 4

    1. Go to the “Tags” page by clicking the “Tags” button from the left menu.
    2. Select your “Google Analytics: GA4 Configuration” tag from the list.
    3. Click the “User Properties” section and click the “Add Row” button.
    4. Type “msclkid” in the “Property Name” field. This is the custom dimension you created in the previous steps.
    5. Click on the “Value” field and select the GTM variable you created in the previous step.
    6. Save your changes.

    You Are All Set! 

    After you complete the steps above, you can now use the MSCLKID to segment your audience based on their behavior, or to see how individual users are interacting with your website over time in your Google Analytics 4 reports.

    Overall, the ability to store the MSCLKID in GA4 is a powerful new feature that allows for more accurate tracking and analysis of user behavior. It is a valuable tool if you`re trying to gain a deeper understanding of your website visitors and how they engage with your content.

    More Similar Posts

    Menu