• Search Engine Land
  • Sections
    • SEO
    • SEM
    • Local
    • Retail
    • Google
    • Bing
    • Social
    • Resources
    • More
    • Home
  • Follow Us
    • Follow
  • Search Engine Land
  • SEO
  • SEM
  • Local
  • Retail
  • Google
  • Bing
  • Social
  • Resources
  • Live
  • More
  • Events
    • Follow
  • SUBSCRIBE

Search Engine Land

Search Engine Land
  • SEO
  • SEM
  • Local
  • Retail
  • Google
  • Bing
  • Social
  • Resources
  • More
  • Newsletters
  • Home
Retail

Pause out of stock products with this Google Ads Script

Just in time for holiday shopping season, this script runs hourly and automatically pauses product ads that are out of stock on Shopify.

Wesley Parker on November 21, 2019 at 11:30 am
  • More

Black Friday and the busy holiday season is rapidly approaching, it’s a boom time for retailers, but with the fast-moving environment, products rapidly go out stock, often with ads still running resulting in wasted budget.

With large inventories, it’s almost impossible to keep on top of pausing ads to out of stock products manually. 

We hated seeing retailers wasting paid media budget, so our team of developers built this Google Ads script that runs hourly and automatically pauses ads pointing to products that are out of stock on Shopify.

How does the script work?

The logic behind the script is quite simple. It follows the URLs of all active ads to the landing page and searches the landing page for a certain string of text, for example: “out of stock.” 

If the product is out of stock then the ads are paused and the ads should then be labeled with “Paused – Out of Stock.” 

The script also auto-enables ads that are back in stock. It reviews all ads that are labeled “Paused – Out of Stock” to see if the product is back in stock and if it is it will re-enable the ads.

It is worth noting that if you have a multi-variant product (sizes, for example) and your URL leads to an out of stock choice, this will be classified as an out of stock item. 

How to configure the script

The script has a number of different options that you can configure depending on how you want to use it.

On line 16: Enter a common element of all of the campaigns that you want to include. If you want the script to work across all campaigns leave this blank. We would only suggest running this script on product level campaigns where ads point directly to a product page URL as opposed to a category page or other page on the website.

On line 19: Enter a common element of all of the campaigns that you want to exclude. If you want the script to work across all campaigns leave this blank.

On line 22 Enter the html element that you can find using inspect element detail on the page string. For example “sold_out.”

On line 25: Enter the part of the URL that identifies product pages. This is important otherwise the script will also scan category pages and if you have an out of stock product may pause all of the ads pointing towards the category which you will not want to do. For example, if your site is gymshark.com/products/gymshark-scrunchie-black then you would select enter /product/ as this is the common element for all product pages.

Once you’ve configured the script make sure that you test it to ensure that you’ve configured it correctly and the functionality is as expected.

Finally, you will need to set up the script on a schedule so that it runs hourly. It will then check all of your ads to ensure that they are not pointing towards any out of stock products and if they are pause them.

The Script 


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

Wesley Parker
Wesley is managing director at Clicteq. He currently manages a $4M-plus Google Ads portfolio across a range of different sectors. He regularly writes in leading marketing publications such as Econsultancy and Campaign Magazine.

Related Topics

Channel: RetailGoogleGoogle AdsGoogle Shopping AdsGoogle: Ads ScriptsPaid Search ColumnSearch Ads: Product AdsSearch Engines: Shopping Search Engines

We're listening.

Have something to say about this article? Share it with us on Facebook, Twitter or our LinkedIn Group.

Get the daily newsletter search marketers rely on.
See terms.

ATTEND OUR EVENTS

Lorem ipsum doler this is promo text about SMX events.

February 23, 2021: SMX Report

April 13, 2021: SMX Create

May 18-19, 2021: SMX London

June 8-9, 2021: SMX Paris

June 15-16, 2021: SMX Advanced

August 17, 2021: SMX Convert

November 9-10, 2021: SMX Next

October 2021: SMX Advanced Europe

December 17, 2021: SMX Code

Available On-Demand: SMX

×


Learn More About Our SMX Events

Discover actionable tactics that can help you overcome crucial marketing challenges. Our next conference will be held:

MarTech 2021: March 16-17

MarTech 2021: Sept. 14-15

MarTech 2020: Watch On-Demand

×

Attend MarTech - Click Here


Learn More About Our MarTech Events

White Papers

  • 6 Powerful Ways Experience Analytics Can Help Your Business Now
  • Email Tune-Up: A 5-Point Inspection to Get Your Program in Gear
  • Digital Marketing Report Q4 2020: Benchmarks and Insights for 2021
  • Data SEO – The Next Big Adventure
  • Getting Started with Email Marketing Automation
See More Whitepapers

Webinars

  • How to Avoid the Digital Transformation Trap
  • How to Build a Marketing System of Record
  • Meet BIMI: The brand-boosting email security marketers must have for 2021
See More Webinars

Research Reports

  • Local Marketing Solutions for Multi-Location Businesses
  • Enterprise Digital Asset Management Platforms
  • Identity Resolution Platforms
  • Customer Data Platforms
  • B2B Marketing Automation Platforms
  • Call Analytics Platforms
See More Research

h
Receive daily search news and analysis.
Search Engine Land
Download the Search Engine Land App on iTunes Download the Search Engine Land App on Google Play

Channels

  • SEO
  • SEM
  • Local
  • Retail
  • Google
  • Bing
  • Social

Our Events

  • SMX
  • MarTech

Resources

  • White Papers
  • Research
  • Webinars
  • Search Marketing Expo
  • MarTech Conference

About

  • About Us
  • Contact
  • Privacy
  • Marketing Opportunities
  • Staff
  • Connect With Us

Follow Us

  • Facebook
  • Twitter
  • LinkedIn
  • Newsletters
  • Instagram
  • RSS
  • Youtube
  • iOS App
  • Google Play

© 2021 Third Door Media, Inc. All rights reserved.

Your privacy means the world to us. We share your personal information only when you give us explicit permission to do so, and confirm we have your permission each time. Learn more by viewing our privacy policy.Ok