Are you getting incorrect campaign names for your Google Ads traffic in GA4?

Last Updated on December 2, 2024 by Alexander Rydberg Ling

Many marketers have experienced the problem where Google Ads traffic in Google Analytics 4 (GA4) does not always get the correct campaign name. Instead of being correctly attributed as paid search traffic, it may appear as “(organic)” or “(not set)”. This can create confusion and lead to incorrect conclusions about how effective your campaigns actually are.

Why does this happen?

This issue often arises when users decline ad personalization consent on your website or disable personalized ads at the Google account level. When this happens, GA4 is unable to attribute the traffic to the correct campaign, resulting in default labels like “(organic)” or “(not set)”.

The Solution: Manual UTM Tagging for Accurate Attribution

To ensure that your Google Ads traffic is always attributed correctly in GA4, you can manually update your Final URLs in Google Ads to include UTM parameters. This way, GA4 will have all the necessary information to accurately track the campaign.

Step-by-Step: How to Fix Incorrect Campaign Attribution

  1. Identify Affected Campaigns:
    In GA4, navigate to Acquisition > Traffic Acquisition. Change the primary dimension to “Session source/medium” and add “Campaign name” as a secondary dimension. Look for entries labeled “(organic)” or “(not set)”.
  2. Update Final URLs with UTM Parameters:
    Edit the Final URLs of the affected campaigns in Google Ads to include UTM parameters.

    For example: https://www.yourwebsite.com/?utm_source=google&utm_medium=cpc&utm_campaign=YourCampaignName

    This manual tagging ensures that GA4 receives the correct campaign information every time someone clicks on your ad.
  3. Automate the Process with Google Ads Scripts:
    To streamline the tagging process, consider using Google Ads scripts to automate UTM tagging. You can set up scripts that run on an hourly basis, ensuring that your campaigns are consistently updated with the appropriate UTM parameters.

Detailed Instructions on Using Google Ads Scripts

Automating UTM tagging with Google Ads scripts can save you time and effort, ensuring that your campaigns are always correctly tagged without manual intervention.

Here is how you can set up a Google Ads script for UTM tagging:

1. Access Google Ads Scripts:

   – Log in to your Google Ads account and navigate to the “Tools & Settings” menu.

   – Under “Bulk Actions,” select “Scripts.”

2. Create a New Script:

   – Click on the plus button to create a new script.

   – Copy and paste the following script, which automatically appends UTM parameters to your campaigns:

function main() {
  Logger.log("Processing account: " + AdsApp.currentAccount().getCustomerId());

  // Campaign types to handle
  const campaignTypes = [
    { iterator: AdsApp.campaigns(), name: "Standard & Others" },
    { iterator: AdsApp.shoppingCampaigns(), name: "Shopping" },
    { iterator: AdsApp.performanceMaxCampaigns(), name: "Performance Max" }
    // Uncomment for video campaigns
    // { iterator: AdsApp.videoCampaigns(), name: "Video" }
  ];

  // Process each campaign type with error handling
  campaignTypes.forEach(({ iterator, name }) => tryHandleCampaigns(iterator, name));

  Logger.log("Processing completed for account: " + AdsApp.currentAccount().getCustomerId());
}

function tryHandleCampaigns(campaignIteratorFunction, campaignType) {
  try {
    const campaignIterator = campaignIteratorFunction.withCondition('Status != REMOVED').get();
    while (campaignIterator.hasNext()) {
      handleCampaign(campaignIterator.next(), campaignType);
    }
  } catch (e) {
    Logger.log(`Error processing ${campaignType} campaigns: ${e.message}`);
  }
}

function handleCampaign(campaign, campaignType) {
  try {
    const trackingTemplate = "{lpurl}?utm_source=google&utm_medium=cpc&utm_campaign={_campaign}&utm_id=" + campaign.getId();
    campaign.urls().setTrackingTemplate(trackingTemplate);
    campaign.urls().setCustomParameters({ campaign: encodeURIComponent(campaign.getName()) });
  } catch (e) {
    Logger.log(`Error processing campaign ${campaign.getId()} in ${campaignType}: ${e.message}`);
  }
}

3. Authorize and Preview:

   – Authorize the script to access your account.

   – Click on “Preview” to see how the script will modify your campaigns. This allows you to verify that everything is working as expected before making any changes.

4. Set a Schedule:

   – Once you are satisfied with the script, set it to run on a regular basis, such as hourly or daily. This ensures that any new campaigns or changes to URLs are automatically updated with the correct UTM parameters.

Benefits of This Approach

  1. Accurate Attribution:
    Ensures that your Google Ads traffic is correctly attributed in GA4, leading to reliable data for analysis.
  2. Improved Reporting:
    Reduces the occurrence of “(organic)” or “(not set)” labels, resulting in more precise and meaningful reports.
  3. Enhanced Decision-Making:
    With accurate campaign data, you can make better-informed decisions to optimize your marketing strategies.

Summary

If your Google Ads traffic sometimes appears as “(organic)” or “(not set)” in GA4, this can be resolved by manually updating your Final URLs in Google Ads to include relevant UTM parameters, or by automating the process using Google Ads scripts. This solution provides better control over campaign tracking and ensures that your data is accurate, helping you make the most of your advertising efforts.

Take the first step today and implement UTM tagging for your campaigns to avoid misattribution and gain deeper insights into your marketing performance!