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.

Enjoy!

Leave a Comment

Carl Paradiso
Carl joined 3Q Digital in August 2012 after a yoga-teaching, soul-searching and travel-filled sabbatical. Since joining 3Q, he’s led the team that has built and supported a cloud-native set of services that have scaled with the company as it has grown from 40 to 280 employees and 2 to 9 offices. He’s continually working to refine infrastructure, services, security, and privacy to meet the needs of larger clients and a more complex marketing ecosystem while maintaining the nimble and collaborative environment that younger workforces demand. Prior to joining 3Q, Carl spent 13 years at the various incarnations of Diamond Management and Technology Consultants, where he directed IT infrastructure, security, and support throughout the company’s entire lifecycle of startup, going public, and expanding internationally organically and through acquisitions.