October 8, 2019
3 Unique Features to Microsoft Ads
Managing a Google MCC, the list of all Google accounts an agency works with, or that are owned by a company, is a huge undertaking. The larger it gets, the more complexity it presents. However, managing it does get a lot easier with a basic MCC-level email alert script.
Metric Theory’s AMP Team (Analytics, Measurement, and Product) has built a lot of scripts to improve client experience and make account management easier for our strategy teams. A very common script can alert you via email when you reach a certain percent difference in a given performance metric week-over-week. For example, you could be alerted when you have an account that has a spend increase yesterday, compared to last week, of over 100%. In this post, we are going to show you how to create a basic MCC-level email alert script in Google Ads Scripts.
To start, we need to create an empty script at our MCC-level scripts menu. Next, we are going to want to have three empty functions: “main”, “Email_Alerts”, and “Delta_Calculation”. The main function will handle running the entire script; whereas the Email_Alerts function will handle the actual Email Alerts themselves, and the Delta_Calculation function will handle the week delta calculations.
The Delta_Calculation function will receive two parameters, yesterday’s spend (current) and 7 days back from yesterday’s spend (prev). The week delta calculation is very easy, here is the formula: ((current – prev) / prev) * 100. In week delta, we also want to remove the comma separators if they exist, this will prevent some common errors. Below is what the function should look like:
The Email_Alerts function is the main function in this script. Specifically, it will loop through your MCC and determine whether the account triggers an alert. This function takes two parameters: the Email Addresses you wish to send triggers to, and the actual trigger value that you would like. To start, we are going to select all accounts in our MCC that have over 0 impressions in the last 7 days. Unfortunately in Google Ads Scripts, you currently cannot specify status as a filter at the MCC level, which is why we are using the impression filter. After we grab all of these accounts, we are going to iterate through them and pull yesterday’s spend and 7 days from yesterday’s spend. We will then plug these current and previous values into the Delta_Calculations function. Lastly, we check to see whether our week delta value hits the trigger as a positive or as a negative, and if so we add it to an email array (accounts_triggered). Once we loop through our MCC, we send an email alert to our inputted email addresses if we have 1 or more accounts triggered. Below is what the function should look like:
Our final function is the easiest, the main function. All we want in here are two input variables: the trigger value and the email addresses you would like in the email alerts. Lastly, we want to send these parameters through our Email Alerts function. All you have to do now is modify the two above parameters as needed, and then just schedule and run your new Email Alerts Script. Your main function should look like this:
Automated alerts are key for successfully managing a Google Ads account/MCC. If you’re looking into growing your business with automation and scripts, contact Metric Theory today to discuss potential strategies and tools that could be used on your account.