An Elegant, Time-Saving Model for Customizing AdWords Scripts Selectors
Published: January 19, 2017
Author: Carl Paradiso
At 3Q Digital, we’re always pushing the innovation envelope; we believe this is an essential component of success in an industry that changes so frequently. This post is part of our inaugural Innovation Week, where we showcase all manner of innovations that have improved results for our clients and teammates.
There are so many excellent AdWords scripts being shared online, but they often don’t work well with many of the large client accounts that we manage at 3Q. We’ve come up with an approach that easily fits into existing scripts and enables them to be shared amongst the many client teams at 3Q and to be easily customized for each account.
Here’s a concise ad selector that you would find in a typical script that will loop through all of the ads easily – in an account with 5000 ads:
But for an account with 5,000,000 ads, looping through all of them would take longer than the 30-minute window allotted to AdWords scripts, and we’ll often want to operate only on a subset of those ads.
Here’s a structure that can be fit into an existing script that will allow each application of the script to be customized in a safe “options section” without having to get into the more complex selection condition code.
The first part is the options section, which goes before the “function main()” declaration line and allows the person using the script to safely add any combination of criteria.
The second part replaces the simple selector with a conditional selector, which inserts conditions only if they’ve been selected in the options section above.
The script can be shared throughout the company and then the person adding the script to a given account simply inserts the desired criteria for that account into the double-quoted options following the commented instructions.
These options are a model, and if they don’t fit your script or clients, you can modify them or use the structure with a different selector, such as the ad group selector. Just keep the complex code tucked away in the body of the code, and document the options clearly in the options section.