Anomaly Detector - User Guide
Geetanjali Tyagi avatar
Written by Geetanjali Tyagi
Updated over a week ago

On this page:


The Anomaly Detector script lets you set an alert for scenarios where an account's key metrics deviate from the expected performance levels, for a given day of the week and hour of the day. It lets you see the status of all your accounts in a single spreadsheet and serves as a mini dashboard.

Basic Settings

Google Spreadsheet Settings

The script outputs the results onto a Google Spreadsheet. There are two options for this, you can:

  1. Paste the results into an existing spreadsheet. For this, you'll need to detail the address of the spreadsheet. The sharing settings for the spreadsheet should be 'anyone with a link'.

Please note that if the sharing settings are not correct, the script will not be able to write the URLs it checks, onto the spreadsheet. You’ll also set a name under “name of target sheet” that’ll be the one used to create a new sheet if the one you’ve selected isn’t already present.

  1. Create a new spreadsheet each time the script runs. For this, simply leave "NEW", in the text field. Under the “name of target sheet” you’ll define which name to use for the new spreadsheet.

How it works

The script checks if all the required columns and rows are present, based on the given sheet name and the current Account ID the script is executing for. If the script can’t find them, it’ll create a new row with the Account ID and the required missing columns.

The way it works is it’ll first pull in data for the day the script is run, and then for each day of the past weeks chosen. For example, if the script is run on Thursday with past weeks as 4, the data pulled will be for every Thursday of the last 4 weeks. It does this up until the current hour it is running at, minus the offset hours defined, to avoid reporting delays.

Notification and Sharing Settings 

  • Share Results Spreadsheet With These Google Accounts: Enter additional email addresses you want to share the spreadsheet with. Use a comma-separated list for multiple email addresses.

  • Sensitivity of Alerts: You can set the sensitivity of alerts for different metrics by defining a threshold for metrics like Impression, Clicks, Cost, and Conversions. Threshold means the percentage by which today's values may differ from the expected averages before triggering an anomaly alert. 

For example, 0.20 means an anomaly is triggered if there is more than a 20 percent difference, either higher or lower. Select 0 if you do not want to be alerted about this metric.

Advanced Settings

  • How to Calculate the Baseline of What is Expected: The number of weeks used to calculate the average expected performance.

  • When to Get Alerts: If it is left blank, the script will run for every hour. However, if you are looking to run the script for only certain hours, you’ll need to mention them here under comma-separated values. In this case, the script will compare the current hour to the hours mentioned, and if it matches, the script will run.

Note: The hours defined in Optmyzr settings can only match and work while the script is running in Google Ads. It won’t supersede the automation frequency of the script configured in Google Ads.

  • How to handle Google Reporting Delays: Google reports are not real-time, so the data from the last three hours may not be included in the reports we use to check for anomalies. Use this setting to specify how many hours we should delay checking. For example, if you choose 3 here, then at 10.00 am we will check stats through 7:00 am. 

Log Settings

  • Show Debug Data In Logs: Select this option to get a complete list of logs that can be useful when reporting a problem to Optmyzr. This option can decrease the performance of scripts so it is recommended to be turned off if not necessarily needed.

  • Show Verbose Output In Logs: Select this option to see how the script operates. This option helps understand how the script works. It may, however, slow down the performance so it is recommended to be used only for the first time you want to check if all the settings are in place.

Did this answer your question?