Enhanced Script: Date Range Comparison

Purpose

This script makes it easier to compare the performance of an account across two date ranges. It downloads reports including account data, campaign data, ad group data, keyword data and ad text data for the two time periods you specify and then combines them into a single Google Spreadsheet that shows the percent change for each item.

Compare AdWords performance for 2 date ranges
Compare AdWords performance for 2 date ranges

Example Use Cases

  • Get a report every Monday that shows last week's account performance compared to two weeks ago
  • Get a report on the first of the month that shows last month's account performance compared to two months ago
  • Get a report that compares the same number of days (and same days of the week) before and after an optimization was made

Settings and Customizations

Replace the following variables with your own values: campaignNameSelectorStatement, time, daysInReport, spreadsheetUrl, includeAccountLevel, includeCampaignLevel, includeAdGroupLevel, includeKeywordLevel, includeAdLevel

campaignNameSelectorStatement (optional)

The campaignSelectorStatement tells the script on which campaigns to operate. It uses the syntax from AdWords Scripts for .withCondition(condition)

  • For example, to operate on all campaigns in an account use: CampaignName CONTAINS_IGNORE_CASE ”
  • To work only on the campaign named "Campaign #1", use: CampaignName = 'Campaign #1'

It is optional when you want to include only account level data. Otherwise this is a required value.

time, daysInReport, optimizationDate, preStartDate, preEndDate, postStartDate, postEndDate (required)

These variable tells the script what type of dates to compare. The allowed values are:

  • Around Opt
  • Specific
  • Last Months
  • Previous Days

"Around Opt" tells the script to look before and after the date of an optimization. A value for daysInReport and optimizationDate is required when you use this.

"Specific" tells the scripts that you will tell it the exact start and end dates for the two periods to compare. A value for preStartDate, preEndDate, postStartDate, postEndDate is required when you use this

"Last Months" tells the script to compare last month's data to two months ago.

"Previous Days" tells the script to compare the last x days with the x days before that. The value of x can be specified in daysInReport which is required when you use this.

spreadsheetUrl

This variable tells the script the URL of the Google Spreadsheet where it should store the results. Allowed values are either the full URL to a Google Spreadsheet or "NEW". In the case of "NEW", the script will create a new spreadsheet to store the results.

includeAccountLevel

This tells the script if it should include an account level comparison. Set to 1 for yes or 0 for no

includeCampaignLevel

This tells the script if it should include a campaign level comparison. Set to 1 for yes or 0 for no

includeAdGroupLevel

This tells the script if it should include an ad group level comparison. Set to 1 for yes or 0 for no

includeKeywordLevel

This tells the script if it should include a keyword comparison. Set to 1 for yes or 0 for no

includeAdLevel

This tells the script if it should include an ad text level comparison. Set to 1 for yes or 0 for no

 

Under The Hood

This script compares the values for any account items during two periods of time and reports the percent change. It can be modified to send alerts when there is a big change or it can be modified to try and correlate changes so that it can pinpoint the items that need your attention the most.

Get This Script

You can run this script from the Enhanced Scripts™ section in your Optmyzr account.

  • Fredrik

    Can it also be used for YtY comparison or is the last month alwasy two months back? Or can I set it to lastmonth compared to twelve months back?

    • http://www.toptiertools.com/ Frederick Vallaeys

      Hi Fredrik,

      To use custom date ranges for the comparison, you can set the value for time to "specific" and then the following would apply from the settings: "Specific" tells the scripts that you will tell it the exact start and end dates for the two periods to compare. A value for preStartDate, preEndDate, postStartDate, postEndDate is required when you use this.

      So you'd have to manually tell it the start and end dates of the two periods you'er comparing but that should work to do a year over year comparison.

      Let us know via the support link if you have any trouble getting it to work this way...

  • Enrique del valle

    With this script ¿ how can you obtain the Spreadsheet URL when you select NEW ?

    • optmyzr.com

      Hi Enrique,

      In the case of "NEW", the script will create a new spreadsheet to store the results. This will be stored in the Google Drive account of the AdWords login email under which the script was run.

  • Enrique del valle

    Ok thanks , I see it.

    I was confused because sometimes scripts send url to email adress.