How to sync your keywords and ad labels with an AdWords Script

Columnist Daniel Gilbert shares a free script to help solve labeling issues by copying labels within an ad group from ads to keywords or vice versa.

Chat with SearchBot

LabelsThe label functionality in AdWords can sometimes be a bit bewildering, and manually having to label a lot of ads or keywords is a task we wouldn’t wish on anyone.

We’ve all been there: You make a bid adjustment, label some 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.

Because we feel your pain, my company created a script to solve your labeling issues. It will copy labels within an ad group from ads to keywords or vice versa. And best of all, it’s free!

The script

I have outlined the script code below. Copy the code below into a new blank script in the AdWords Bulk Actions area, and then change the options at the top as I’ve described here.

Script outline

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”
  • 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.

Including and excluding 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!

I should mention this does not work for shopping, video or universal app campaigns.

AdWords 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.


Opinions expressed in this article are those of the guest author and not necessarily Search Engine Land. Staff authors are listed here.


About the author

Daniel Gilbert
Contributor
Daniel Gilbert is the CEO at Brainlabs, the best paid media agency in the world (self-declared). He has started and invested in a number of big data and technology startups since leaving Google in 2010.

Get the must-read newsletter for search marketers.