Scan Your Landing Pages With AdWords Scripts

error-404-ss-1920

One of the classic tasks to automate with scripts is checking all your URLs for 404 errors. Google has their own Link Checker script, for instance. But this only tells you if a page is broken in a technical sense.

You could easily have pages that aren’t 404s but that you still don’t want to use in your ads. For example:

  • Products that are out of stock.
  • Hotel rooms that are fully booked.
  • Concerts that are sold out or canceled.
  • Search pages with no results.
  • Old pages that say “archived.”
  • Pages with out-of-date messaging like “2014 Holidays” or “Black Friday Sale.”

At Brainlabs (my company), we’ve increased conversion rates by 12 percent simply by pausing ads where the landing page had too few products on it –- so this sort of check is well worth doing. And to make it easy, we wrote a script to check the contents of your landing pages and send you an email if any are bad.

The way the script works is that you give it a phrase (or set of phrases) to look for — like “out of stock” or “currently unavailable.” The script reads each URL’s source code and looks for the phrase(s) in question; if it finds the phrase(s), then it knows the page is bad.

So the first thing to do is work out what phrase(s) your website uses. Make sure you check the source code of good and bad pages. If you pick something that appears on some good pages, then you’ll be turning off good ads or wasting time checking through false positives.

Because the script looks at the code, not the page as it’s rendered, you can include HTML tags. For example, lego.com uses

  • for out-of-stock products, so you could look for that, rather than “out of stock.” This has the advantage that it’s not likely to appear in good pages (in product titles or user comments).

    lego out of stock

    Be careful with messages like “0 available” — that would match against a page that said “10 available” or “100 available.” You probably want something like “>0 available” (if there’s a HTML tag right before the availability) or ” 0 available” (with a space in front of the 0) to make sure it catches only zeroes and not numbers ending in zero.

    When you’ve figured out what you’re looking for, copy the script into your AdWords account and change the settings:

    • The most important is messagesToCheckFor, where you give the source code of the phrase or phrases to look for. If any of the messages in this array are found in a URL’s source code, then that URL will be treated as bad.
      • If there are double quote marks in your message, then use single quote marks around it. “
      • ” won’t work (because the script will think the string ends at the equals sign) so use ‘
      • ’ instead.
    • If trimAtQuestionMark is set to true, then if there is a ? in your URLs, then it and anything after it is removed. This is in case you have any tags or tracking code in your URLs: Keeping the tags would mean the script would have to check the same page multiple times. However, sometimes the part of the URL after the ? does matter. Search pages may be http://ift.tt/1TPV4aV, for example — in which case, set this to false.
    • type says whether to check URLs in your ads or in your keywords.
    • recipients is an optional list of email addresses. When bad URLs are found, a list will be sent to all the addresses in the list. If you don’t want the bad URLs to be emailed, leave this as [] — the bad URLs will be listed in the logs of the script.
    • There are three optional filtering options, to narrow down which campaigns the script looks at. The format is [“hey”,”jude”], or [] if the option is not wanted.
      • If there are phrases in containsArray, then only campaigns with one of the phrases in the name are considered. This is not case-sensitive.
      • If there are phrase in excludesArray, then any campaigns whose name contains any of them will be ignored. This is not case-sensitive.
      • If there are phrases in labelArray, they are taken to be the names of labels in the account. Only ads/keywords with one of these labels will be looked at. Note that the script will not work if any of the labels do not exist. This is case-sensitive.
    • There are three status options. These can be [“ENABLED”], [“PAUSED”] or [“ENABLED”,”PAUSED”] (which means enabled or paused). Removed campaigns, ad groups and entities are always ignored.
      • campaignStatus is the status of the campaigns.
      • adGroupStatus is the status of the ad groups.
      • status is the status of the ad/keyword itself.

    You could run the script once, as a one-off check, or set up a schedule so it runs every day.

    Note that Google only lets you check 20,000 URLs a day in AdWords scripts, although the script will probably run out of time before hitting that. If your account has too many URLs for the script, you might want to consider using the API to avoid these limits.

    The post Scan Your Landing Pages With AdWords Scripts appeared first on Search Engine Land.