• Search Engine Land
  • Sections
    • SEO
    • SEM
    • Local
    • Retail
    • Google
    • Bing
    • Social
    • Resources
    • More
    • Home
  • Search Engine Land
  • SEO
  • SEM
  • Local
  • Retail
  • Google
  • Bing
  • Social
  • Resources
  • Live
  • More
  • Events
  • 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.

Processing...Please wait.

See terms.

ATTEND OUR EVENTS

Lorem ipsum doler this is promo text about SMX events.

Available On-Demand: SMX Create

May 18-19, 2021: SMX London

June 8-9, 2021: SMX Paris

June 15-16, 2021: SMX Advanced

June 21-22, 2021: SMX Advanced Europe

August 17, 2021: SMX Convert

November 9-10, 2021: SMX Next

December 14, 2021: SMX Code

Available On-Demand: SMX

Available On-Demand: SMX Report

×


Learn More About Our SMX Events

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

Next Event: Sept. 14-15, 2021

Available On-Demand: March 2021

Available On-Demand: October 2020

×

Attend MarTech - Click Here


Learn More About Our MarTech Events

White Papers

  • Gartner Magic Quadrant for Digital Experience Platforms
  • Selecting a Customer Data Platform For Your Organization: The 2020 Gartner Market Guide
  • The Complete Guide to Web Core Vitals
  • The New Era of Automation in SEO
  • Nielsen Annual Marketing Report: Era of Adaptation
See More Whitepapers

Webinars

  • Drive Customer Engagement with the Power of Personalization
  • 7 Use Cases That Prove Why You Should Implement DAM
  • Accelerate Your SEO & Content Marketing Program with 4 Key Milestones
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

Attend SMX For Only $199

h
Receive daily search news and analysis.

Channels

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

Our Events

  • SMX
  • MarTech

Resources

  • White Papers
  • Research
  • Webinars

About

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

Follow Us

  • Facebook
  • Twitter
  • LinkedIn
  • Newsletters
  • RSS
  • Youtube

© 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