Identify Duplicated Ads Script

One day, instead of saying ‘finding a needle in a haystack’ they’ll be saying ‘finding a duplicated ad in a Google Ads account’. Possibly. Or maybe not – if everyone uses this script, and lets automation do all the searching for you. No more duplicates, therefore more accurate testing and far less complication. Nice.

What’s included?

How does the script work?

The script goes through each ad group and finds ads that are the same — either completely identical down to the landing page, or just with the same messaging.

It then looks at the ads’ performance over the last 30 days: the best performing ad (according to your choice of metric) is given a “keep” label, while its evil twin gets a label telling you to pause it. Then you can review the script’s work and comfortably clear your account of copied clutter.

How do I use it?

Copy the code below into a new Google Ads script in your account. Then adjust the options at the top:

  1. campaignNameDoesNotContain and campaignNameContains are used to filter campaigns. For example if campaignNameDoesNotContain is [“Display”, “Shopping”] any campaign with “display” or “shopping” in the name will be ignored. If campaignNameContains is [“Brand”, “Generic”] then any campaign without “brand” or “generic” in the name is ignored.
    • They are not case-sensitive.
    • If you need to put a double quote in, put a backslash before it.
  2. If ignorePausedCampaigns is true, then the script will only look at currently active campaigns. Set them to false if you want to look at currently paused campaigns.
  3. If checkUrl is true, ads are only treated as duplicates if they have the same final URL as well as the same ad copy. If this is false, then ads are treated as duplicates even if they have different landing pages.
    • Set this to true if you have landing page tests going on.
  4. metric is the name of the stat used to pick which of the duplicate ads is the best.
    • You can choose from CTR, clicks, impressions, cost, average CPC and conversions.
  5. If caseSensitive is true, then the script will pay attention to capitalization when comparing ad text: “Buy This Now” will be treated as different to “buy this now.” If this is false, then ads with the same text but different capitalization will be treated as duplicates.
    • This just affects the ad copy. If you’re checking the final URL, this will always be considered case insensitively.
  6. keepLabel is the name of the label applied to the best duplicate ad. It indicates that this is the ad you should keep active.
  7. Similarly, pauseLabel is the name of the label applied to the rest of the duplicate ads. This label shows the ads you should pause.

If the script does time out, you can run it again; it will ignore any ads it has previously labeled. If your account is really big, you might need to run it on part of the account, rather than the whole account: use campaignNameContains and campaignNameDoesNotContain to look at different sets of campaigns on each run.

The Identify Duplicated Ads Script code