Domain Name Checker Script

For most Google Ads 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 sometimes a rogue URL slips through the cracks. This script checks if you’re inadvertently sending your potential customers to the wrong website entirely.

What’s included?

How does the script work?

This script will help you stay on top of the domains being used in your ads, by verifying the ads are linking to the correct website. After setting up your accounts and campaigns, run the script with the desired domain in your Google Ads 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.

For example, 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.

Or if you’ve migrated to a new website or changed your brand name, you can use this script to check if the old URLs have been replaced or removed from your ads.

Even if you have set up your redirects correctly, these will slow the page loading speed. 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 is also great for monitoring Google Ad Grant accounts, where all ads are required to point to an approved domain. 

How do I use it?

Make a blank Google spreadsheet for the report and note down its URL. On your Google Ads interface, go to Bulk Actions, choose Scripts, make a new script and paste in the script below. Don’t forget to edit these options:

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

The Domain Name Checker Script code

Click to Hide Advanced Floating Content