A non-coders guide and introduction to AdWords Scripts. Presented at PubCon Vegas 2015 a step by step guide to implement AdWords scripts along with an example of how to edit and tweak a pre-written script to do what you want it to do.
2. @ChristiJOlson #pubcon
Christi J. Olson
• Founder iSEM Consulting
• 10+ years marketing management
• Seasoned digital marketing leader
Professional Experience with:
4. @ChristiJOlson #pubcon
Don’t Use WORD for editing or saving
scripts. It can add invisible characters that
cause the code to fail
NotePad++ Outlines and groups together
code
NotePad++ Makes it easier to review the
code
EDIT SCRIPTS IN NOTEPAD OR NOTEPAD++
6. @ChristiJOlson #pubcon
COMMENTS CAN [and should] BE USED WITHIN SCRIPTS
Document what the code is supposed to do,
and options for choices within the code
// IS A SINGLE COMMENT LINE
/* SINGLE FORWARD SLASH + ASTERISK
/* COMMENT SPANNING MULTIPLE LINES */
8. @ChristiJOlson #pubcon
BE PREPARED TO UPDATE SCRIPTS
Upgraded URLs caused some scripts like Broken URL
tracker to break because the variables and entities
changed.
Find instances of : getDestinationUrl
and replace with: urls().getFinalUrl
9. @ChristiJOlson #pubcon
WHAT YOU’LL MOST LIKELY NEED TO EDIT IN EVERY
SCRIPT:
RECIPIENT_EMAIL
your email address
SPREADSHEET_URL
URL for the Google Spreadsheet
// Comma-separated list of recipients. Comment out to not send any emails.
var RECIPIENT_EMAIL = 'christi@iSEMConsulting.com';
// URL of the default spreadsheet template. This should be a copy of http://goo.gl/cULxUX
var SPREADSHEET_URL = 'https://docs.google.com/spreadsheet/abc1234/’
10. @ChristiJOlson #pubcon
bit.ly/Pub-Scripts
Campaign & Keyword Performance Report, Written by Russ Savage
Quality Score Tracker, Written by Martin Roettgerding
Keyword Performance by QS & Position, Written by Google Developers
Anomaly Detector, Written by Google Developers
Broken URL Checker, Written by Google Developers & Russ Savage (FreeAdwordsScripts.com)
Search Queries by N-Grams, Written by Daniel Gilbert
Search Query Manager, Written by Marcela De Vivo (Gryffin.com)
PRE-WRITTEN SCRIPTS YOU SHOULD USE NOW
12. @ChristiJOlson #pubcon
FUNCTIONS
OBJECTS (ELEMENTS)
ENTITIES
VARIABLES
METHODS
SELECTORS
ITERATORS
THE KEY ITEMS YOU NEED TO KNOW:
13. @ChristiJOlson #pubcon
ANATOMY OF A BASIC SCRIPT
function main() {
var keywords = AdWordsApp.keywords()
.withCondition(“Status = ‘ENABLED’”)
.orderBy("Impressions DESC")
.forDateRange("YESTERDAY")
.withLimit(10)
.get();
Logger.log("10 keywords with most impressions yesterday");
while (keywords.hasNext()) {
var keyword = keywords.next();
Logger.log(keyword.getText() + ": " +
keyword.getStatsFor("YESTERDAY").getImpressions());
}
}
FUNCTION
SELECTORS
ITERATOR + next METHODS
VARIABLE, OBJECT, ENTITY
LOGGER
METHODS
closes out the function
closes out the iterator
29. @ChristiJOlson #pubcon
“CHEATING” WITH CUSTOMIZED SCRIPTS
FIND A SIMILAR SCRIPT AND USE IT AS A
FRAMEWORK TO BUILD OUT THE
MORE IN-DEPTH OR ROBUST SCRIPT
THAT YOU WANT
33. @ChristiJOlson #pubcon
CREATE REUSABLE PIECES OF CODE
Create Header Rows within Spreadsheet
Start with Campaigns
(because ad groups are within campaigns)
For Campaigns:
Get Campaign Names
Calculate total KWDs & Negative KWDs
For Ad Groups
Get Ad Group Names
Calculate total KWDs & Negative KWDs
Push everything to the Spreadsheet
Log 1 row per Campaign/Ad Group with Totals
34. @ChristiJOlson #pubcon
CODE FOR: GET CAMPAIGN & AD GROUP DATA
http://bit.ly/PI-GetCMP http://bit.ly/PI-GetAG
CAMPAIGN ITERATOR AD GROUP ITERATORS