Table of Contents Show
Are you struggling with (organic) or (not set) values showing up for Campaign Name when analyzing Google Ads traffic in Google Analytics 4? Looking for a quick fix without waiting for Google’s update?
In this post, I’m going to share a guide on how to solve this issue, authored and shared by ex-Googler Jan Zdarsa (scripts for individual accounts and MCC included!).
First, let’s see if this problem is impacting your Google Analytics 4 account before we explore the solution.
How To Identify If You’re Impacted
In June 2024, users of Google Analytics 4 noticed a problem with the reporting.
The problem is with the campaign name in the Acquisition report. It shows values like (organic) or (not set) for Google Ads traffic for campaign names.
To check your GA4 to see if this behavior impacts you, follow these steps:
- Go to Acquisition > Traffic Acquisition
- Change your dimension to Session source/medium
- Add Campaign name as a secondary dimension
Do you see (organic) or (not set) values? If so, this issue affects you as well.
This behavior affects most of the incoming traffic received from Google Ads.
This is an important issue you shouldn’t ignore if you want to analyze your Google Ads campaigns effectively.
Why Is This Happening?
No specific list has been published outlining when this occurs, but here are two commonly known situations.
Incorrect campaign names appear when users decline ad_user_data in your website’s consent banner or when they disable personalized ads at the Google account level.
Also, when a user turns off personalized ads in My Ad Center, this issue occurs.
Jan Zdarsa said Google may not be able to fix this problem because of privacy issues. He also suggested Google could rename it to something clearer, like “unconsented traffic”.
How To Fix It?
Update Final URLs Manually
When you want to track different sources, what do you do? Exactly. You add UTM parameters to all your links. The same approach applies to fixing Google Ads campaign names.
?utm_source=google&utm_medium=cpc&utm_campaign=My-Campaign&utm_id=My-Campaign-ID
You cannot use tracking templates with ValueTrack parameters in Google Ads to fix this issue as there is no ValueTrack parameter for campaign names.
You won’t see a quick change in GA4 because of the lookback window, but incorrect campaign names will decrease over time.
Free Scripts to Handle UTM Tagging for You
Let the Google Ads script, authored and shared by Jan Zdarsa, do the work for you. Check it out on GitHub.
It’s easy to use and helps you keep your URLs tagged with the right UTM parameters, even if you change your campaign name.
Set it to run hourly to ensure your Final URLs are always up to date.
Maintain automatic tagging enabled.
If the system doesn’t find the campaign name, it will use the UTM value instead of (organic) or (not set) when tagging automatically.
WARNING: Google Ads scripts don’t support Demand Gen and Video campaigns.You’ll have to update those campaigns manually.
Script: UTM tagging for individual accounts
Here’s the script for individual accounts you’ve been waiting for.
function main() {
Logger.log("Processing account: " + AdsApp.currentAccount().getCustomerId());
// Process each campaign type with error handling
tryHandleCampaigns(AdsApp.campaigns(), "Standard & Others");
tryHandleCampaigns(AdsApp.shoppingCampaigns(), "Shopping");
tryHandleCampaigns(AdsApp.performanceMaxCampaigns(), "Performance Max");
// tryHandleCampaigns(AdsApp.videoCampaigns(), "Video");
Logger.log("Processing completed for account: " + AdsApp.currentAccount().getCustomerId());
}
function tryHandleCampaigns(campaignIteratorFunction, campaignType) {
try {
handleCampaigns(campaignIteratorFunction, campaignType);
} catch (e) {
Logger.log("Error processing " + campaignType + " campaigns: " + e.message);
}
}
function handleCampaigns(campaignIteratorFunction, campaignType) {
var campaignIterator = campaignIteratorFunction
.withCondition('Status != REMOVED')
.get();
while (campaignIterator.hasNext()) {
var campaign = campaignIterator.next();
try {
var trackingTemplate = "{lpurl}?utm_source=google&utm_medium=cpc&utm_campaign={_campaign}&utm_id=" + campaign.getId();
campaign.urls().setTrackingTemplate(trackingTemplate);
// Set custom parameters or perform other universal actions here
campaign.urls().setCustomParameters({campaign: encodeURIComponent(campaign.getName())});
} catch (e) {
Logger.log("Error processing campaign " + campaign.getId() + " in " + campaignType + ": " + e.message);
}
}
}
To make sure you are using the latest version, check out its GitHub page.
Script: UTM tagging for MCC
Would you prefer the MCC version that allows you to manage multiple accounts with a single script? Here it is…
Reminder: Google Ads scripts can manage up to 50 accounts. If you have more, you’ll need to personalize the code.
function main() {
const accountSelector = AdsManagerApp.accounts().withLimit(50); // Adjust the limit as needed
accountSelector.executeInParallel('processAccount', 'allFinished');
}
function processAccount() {
var account = AdsApp.currentAccount();
Logger.log("Processing account: " + account.getCustomerId());
// Process each campaign type with error handling
tryHandleCampaigns(AdsApp.campaigns(), "Standard & Others");
tryHandleCampaigns(AdsApp.shoppingCampaigns(), "Shopping");
tryHandleCampaigns(AdsApp.performanceMaxCampaigns(), "Performance Max");
// tryHandleCampaigns(AdsApp.videoCampaigns(), "Video");
// Return a result that you can use later in allFinished (optional)
return account.getCustomerId();
}
function tryHandleCampaigns(campaignIteratorFunction, campaignType) {
try {
handleCampaigns(campaignIteratorFunction, campaignType);
} catch (e) {
Logger.log("Error processing " + campaignType + " campaigns: " + e.message);
}
}
function handleCampaigns(campaignIteratorFunction, campaignType) {
var campaignIterator = campaignIteratorFunction
.withCondition('Status != REMOVED')
.get();
while (campaignIterator.hasNext()) {
var campaign = campaignIterator.next();
try {
var trackingTemplate = "{lpurl}?utm_source=google&utm_medium=cpc&utm_campaign={_campaign}&utm_id=" + campaign.getId();
campaign.urls().setTrackingTemplate(trackingTemplate);
// Set custom parameters or perform other universal actions here
campaign.urls().setCustomParameters({campaign: encodeURIComponent(campaign.getName())});
} catch (e) {
Logger.log("Error processing campaign " + campaign.getId() + " in " + campaignType + ": " + e.message);
}
}
}
// This function is optional but allows you to handle any results after all accounts are processed
function allFinished(results) {
for (var i = 0; i < results.length; i++) {
var result = results[i];
if (result.getStatus() === 'OK') {
Logger.log("Successfully processed account: " + result.getCustomerId());
} else {
Logger.log("Failed to process account: " + result.getCustomerId() + " with error: " + result.getError());
}
}
}
To make sure you are using the latest version, check out its GitHub page.
Add UTM tracking to your Google Ads campaigns and don’t let incorrect campaign names affect your insights.