Did you run the same Google Ads scripts in multiple accounts? Then you know, like me, that a small change or improvement in your script leads to a lot of work. You have to process this change in all scripts. That can be much easier!

Now, of course, a question pops up: "Why do not you use an MCC script?" Well, the scripts used often use variables that are account-specific. I therefore want to be able to set it up per account.

"Yes, but ...", I hear you think now, "... then you use an MCC script in combination with a Google Sheet, in which you define these variables per account?". Yes, that's a good plan for different scripts, but the problem is that you quickly run out of time because the script can run for up to 30 minutes.

Universal solution

In order to keep everything organized and to make managing the Google Ads scripts as simple as possible, we chose a different solution at Increase. We now manage our scripts on Google Drive, so we have a central place for the scripts and a change in this script affects all accounts that use the script.

Creating .js files on Google Drive is easily done by installing the 'Javascript Editey' app as an addon. This allows you to create and edit new Javascript files. The great convenience of this is the user management. You can determine who has access to the scripts, so that it does not happen that someone accidentally breaks the script.

Calling external scripts

When replacing a script in a Google Ads account for an external script, we create two new scripts on Google Drive. One with the contents of the function main (mandatory in the script) and another script with the other functions from the script. We can use these scripts by loading the contents with the DriveApp and executing them through the eval () function. When you create a new JS file in Google Drive, use the last part of the URL as an ID for in the script.

And this works as hoped. You can use variables between different scripts and the online Scripts editor. It is possible that the execution of your script is a bit slower than directly from Google Ads, but in our case this does not outweigh the ease of management.

Script
// Copyright 2019. Increase BV. All Rights Reserved.
//
// Created By: Tibbe van Asten
// for Increase B.V.
//
////////////////////////////////////////////////////////////////////

var config = {
 
  LOG : true,
  
  SCRIPT_MAIN : 'XXX',
  SCRIPT_OTHER : 'YYY',
  
}

////////////////////////////////////////////////////////////////////

function main() {
  
    var accountId = AdsApp.currentAccount().getCustomerId();

    // Load & execute external script by ID
    var main = DriveApp.getFileById(config.SCRIPT_MAIN).getBlob().getDataAsString();
    eval(main);
  
} // function main()

    // Load & execute external script by ID
    var other = DriveApp.getFileById(config.SCRIPT_OTHER).getBlob().getDataAsString();
    eval(other);

 

Security of your script

To ensure that our scripts are not indiscriminately taken over by others, we protect them. In a separate .js file on Google Drive, we created an array containing the account IDs on which our scripts are allowed to run. When someone then literally takes over our code, it can not be used in another account, because the script checks which account is trying to use the script.

Preferably you want to keep the written code out of the Google Ads Script secret, so that no one gets away with it. But for this the explanation above is no solution. With a little bit of effort, you can eventually figure out the underlying code. Although it is not the purpose of this method, we have made taking over our scripts a bit more difficult.

Sharing knowledge

Adsscripts.com is all about sharing knowledge. In the current market, PPC specialists like to keep their knowledge and experience to themselves. We're convinced that sharing knowledge can ensure that everyone gets better at their work. We want to change this by sharing our knowledge about scripts with everyone.

Do you also want to contribute? We are open to new ideas and feedback on everything you find on Adsscripts.com.

Contact us

Nils Rooijmans
Google Ads Scripter
Water Cooler Topics
Nils Rooijmans, Google Ads Scripter
Bas Baudoin
Teamleader PPC
Happy Leads
Bas Baudoin, Teamleader PPC
Martijn Kraan
Freelance PPC Specialist
Brightstep
Martijn Kraan, Freelance PPC Specialist
Tibbe van Asten
PPC Specialist
Founder Adsscripts
Tibbe van Asten, Senior PPC Automation Specialist