Are your ads pointing to the right domain? Here’s a script to find out.

Standards are high for PPC superheroes, and even the best of us can make a mistake.

Luckily, there’s a perfectly easy way to deal with human error: automation!

I’d like to share a script that will help you stay on top of the domains being used in your ads, by verifying the ads are linking to the correct website.

Start with a site visit

For most AdWords campaigns, the user’s journey to conversion starts with a site visit. Making sure users end up on the right page after clicking on an ad may seem obvious, but as careful as we might be, sometimes a rogue uniform resource locator (URL) slips through the cracks.  This script checks if you’re inadvertently sending your potential customers to the wrong website entirely.

After setting up your accounts and campaigns, run the script with the desired domain in your AdWords account, and it will scan through your keywords and URLs to list which ones have final URLs that don’t use that domain. This could come in handy in lots of situations.

If you have different sub-domains or top-level domains for different countries or different parts of your business, this will point out that the wrong URL has sneaked in there somewhere.

For example: yourdomain.com instead of yourdomian.co.uk.

Check for old URLs

Another circumstance where I recommend using the script is after migrating to a new website. It is important to make sure the old URLs have been replaced or removed from your ads.

Have you changed your brand name? The script can also be effective if your brand name has undergone a change and you need a new domain name.

You definitely don’t want the old domain appearing in your ad; that doesn’t help you establish your new name. You also don’t want to accidentally send people to your old website instead of the new one.

Even if you have set up your redirects correctly, they will slow the page loading speed, which isn’t optimal.

According to an April 2017 report from The State of Online Retail Performance, conversions can fall by up to 20 percent for every second delay in mobile site load time in the retail sector.

This script will help you confirm whether you’ve got everything running as smoothly and speedily as possible.

Lastly, I want to mention the script is great for monitoring Google Ad Grant accounts, in which all ads are required to point to an approved domain. Avoiding mistakes is a must here.

Getting started

To use this script, make a blank Google spreadsheet for the report and note down its URL. On your AdWords interface, go to Bulk Actions, choose Scripts, then make a new one and paste in the script. Don’t forget to edit the options listed below.

Script outline

  • domainName is the domain you expect to be in all your keyword and ad URLs.
  • isWholeDomainName should be set to true if the domainName is everything between the https:// and the next /.
  • Set it to false if domainName is the top-level domain, and you don’t mind what subdomains your ads point to.
  • targetSheetUrl is the URL of your blank Google Doc spreadsheet, which the results will be written into.
  • 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 is not case-sensitive.
    • Leave blank, [], to include all campaigns.
    • If you need to put a double quote into campaignNameContains or campaignNameDoesNotContain, put a backslash before it.
    • ignorePausedCampaigns should be set to true if you only want to look at currently active campaigns, or false if you want to include them.

If you’re having trouble with the script timing out, try running the script multiple times using campaignNameContains and campaignNameDoesNotContain to look at different campaigns for each run.

And there you have it. Hopefully, your domains are all set up right, but it never hurts to be extra careful at every step, especially when a convenient script can take care of the work for you.


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