Sync Keyword and Ad Labels Script

The label functionality in Google Ads can be a bit confusing, and manually labelling a bunch of ads and keywords is a task we wouldn’t wish on anyone.

We’ve all been there: you make a bid adjustment, label a few keywords in an ad group to reflect this change, and then when looking at ads within that same ad group, you can’t see the labels. So you set about the mind-numbing chore of copying labels from entity to entity. We feel your pain!

What’s included?

How does the script work?

We’ve made this script to solve all your labelling issues by copying labels within an ad group from ads to keywords or vice versa.

How do I use it?

Copy the code below into a new blank script in Google Ads, and then change the following options at the top:

1. Fill in label names with the names of the labels you want to be copied

Note that this is case-sensitive — type carefully!

  • copyLabelsFrom is the type of entity you’re copying labels from.
  • copyLabelsTo is the type of entity you’re copying labels to.
  • copyLabelsFrom and copyLabelsTo can be any of “Keyword” and “Ad”
  • A threshold is the proportion of entities of the type copyLabelsFrom that must be labeled for the entities of the type copyLabelsTo to be labeled.

For instance, if copyLabelsTo is “Keyword” and copyLabelsFrom is “Ad” then:

  • 1 means the keywords are only labeled if all ads are labeled.
  • 0.9 means the keywords are labeled if at least 90 percent of ads are labeled.
  • 0 means the keywords are labeled if at least one ad is labeled.

2. Include or exclude certain campaigns

campaignNameContains and campaignNameDoesNotContain filter which campaigns the script gets data from.

For example, if campaignNameContains is [“Brand”, “Generic”], then only campaigns with names containing “brand” or “generic” are included. If campaignNameDoesNotContain is [“Display”, “Competitor”] then any campaigns with names containing “display” or “competitor” are ignored.

This next part is not case-sensitive.

Leave campaignNameContains blank, [ ], to include all campaigns.

If you need to put a double quote into campaignNameContains or campaignNameDoesNotContain — if the campaign name itself uses quotation marks — put a backslash, \, before it.

ignorePausedCampaigns, ignorePausedAdGroups and ignorePausedAdsAndKeywords filter which entities the script looks at based on status. They should all be set to “true” if you only want to look at currently active things.

Removed things are always ignored — they’re deleted, so it’s not like you can change them!

Note that this does not work for Shopping, Video or Universal App Campaigns.

Google Ads Scripts can only run for 30 minutes. If your account is too big for the script to run, you could run it multiple times.

Use campaignNameContains and campaignNameDoesNotContain to go over different parts of the account each time.

The Sync Keyword & Ad Labels Script code