How to store MSCLKID in Google Analytics 4

Storing MSCLKID in Google Analytics 4 is a straightforward process, made possible using “Custom Definitions” and “Google Tag Manager”. This guide will walk you through the necessary steps to achieve this.

On this page
    How to store MSCLKID in Google Analytics 4

    What is the MSCLKID? 

    MSCLKID is a parameter used for click tracking in Microsoft Ads campaign. This parameter is sent to the ad redirect page by the user’s browser who clicked the ad, where a click tracking cookie is created. This cookie tracks actions taken after the user clicks 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. Using this parameter, advertisers can track how effective their ads are and how many sales they make. It’ll help advertisers to make their advertising decisions more consciously and try to make their advertisements more effective.

    Why is it important to store MSCLKID in Google Analytics 4? 

    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 behave after they click on an ad or other marketing material. You can use Google Analytics 4 reports and the MSCLKID to decide 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’ll 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 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 must 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 campaign, a “MSCLKID ” parameter is automatically added to the end of the site address they’re visiting. Unfortunately, Google Analytics 4 can’t automatically store this parameter. It’s 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 “MSCLKIDd” 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 separated the “MSCKLID” parameter from the site URL and stored it in a variable. However, this data is still only available on the GTM. In this step, you’ll 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 the Measurement ID of your Google Analytics 4 property. You can get more information from this page, if you don’t know your measurement ID.
    6. Click the “User Properties” section and 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 to 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 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’re all set

    After you complete the steps above, you can now use the MSCLKID to segment your audience based on their behavior or see how individual users interact 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’s a valuable tool if you`re trying to gain a deeper understanding of your website visitors and how they engage with your content.

    We’re here to provide a tailor-made strategy that fits your unique needs. Let’s start creating your custom solution today. Contact us now.

    More Similar Posts

    Menu