@ChristiJOlson #pubcon
Christi Olson
iSEM Consulting
Part 3:
A Non-Coders Guide to Editing
AdWords Scripts
@ChristiJOlson #pubcon
Christi J. Olson
• Founder iSEM Consulting
• 10+ years marketing management
• Seasoned digital marketing leader
Professional Experience with:
@ChristiJOlson #pubcon
HELPFUL TIPS
BEFORE YOU GET STARTED EDITING
@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++
@ChristiJOlson #pubcon
SCRIPTS ARE CASE SENSITIVE AND NEED TO BE WRITTEN
IN camelCase
@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 */
@ChristiJOlson #pubcon
BE PREPARED TO UPDATE SCRIPTS
CHANGES IN ADWORDS, CAUSE VARIABLES AND ENTITIES
WITHIN EXISTING SCRIPTS TO CHANGE
@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
@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/’
@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
@ChristiJOlson #pubcon
SCRIPTING BASICS
THE ANATOMY OF WHAT’S IN A SCRIPT
@ChristiJOlson #pubcon
 FUNCTIONS
 OBJECTS (ELEMENTS)
 ENTITIES
 VARIABLES
 METHODS
 SELECTORS
 ITERATORS
THE KEY ITEMS YOU NEED TO KNOW:
@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
@ChristiJOlson #pubcon
HOW TO USE SCRIPTS
IN THE ADWORDS INTERFACE
@ChristiJOlson #pubcon
WHERE TO FIND SCRIPTS IN THE ADWORDS UI
@ChristiJOlson #pubcon
SCRIPTS UI – WHEN YOU HAVEN’T USED IT
@ChristiJOlson #pubcon
SCRIPTS UI – ONCE YOU’VE ADDED/RUN A SCRIPT
@ChristiJOlson #pubcon
STEP 1: ADD A SCRIPT
@ChristiJOlson #pubcon
STEP 2: COPY PRE-WRITTEN SCRIPT INTO NOTEPAD++
@ChristiJOlson #pubcon
STEP 3: UPDATE SPREADSHEET URL & OTHER FIELDS
@ChristiJOlson #pubcon
STEP 4: NAME THE SCRIPT & PASTE INTO EDITOR
@ChristiJOlson #pubcon
STEP 5: AUTHORIZE SCRIPT & PREVIEW
@ChristiJOlson #pubcon
STEP 6: DEBUG VIA LOGS (IF NECESSARY)
@ChristiJOlson #pubcon
STEP 6: DEBUG VIA LOGS (IF NECESSARY)
@ChristiJOlson #pubcon
STEP 6: DEBUG VIA LOGS (IF NECESSARY)
@ChristiJOlson #pubcon
PREVIEW THE DATA IN THE SHARED DOC
@ChristiJOlson #pubcon
STEP 7: SCHEDULING
@ChristiJOlson #pubcon
MAKING MORE EDITS TO SCRIPTS
WHEN YOU WANT TO ADD MORE DATA
@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
@ChristiJOlson #pubcon
GREAT AUDIT SCRIPT, BUT THE FORMAT WASN’T IDEAL
DATA WAS IN A LOG OUTPUT
@ChristiJOlson #pubcon
I WANTED AN XLS SPREADSHEET INSTEAD OF LOG OUTPUT
@ChristiJOlson #pubcon
MAP WHAT THE SCRIPT DOES, AND WHAT YOU WANT
IT TO DO
@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
@ChristiJOlson #pubcon
CODE FOR: GET CAMPAIGN & AD GROUP DATA
http://bit.ly/PI-GetCMP http://bit.ly/PI-GetAG
CAMPAIGN ITERATOR AD GROUP ITERATORS
@ChristiJOlson #pubcon
CODE TO GET CAMPAIGN & AD GROUP DATA
@ChristiJOlson #pubcon
bit.ly/PI-SpreadsheetScript
CODE TO PREP THE SPREADSHEET
@ChristiJOlson #pubcon
CODE TO CREATE & WRITE TO GOOGLE DOC
@ChristiJOlson #pubcon
USED THE ORIGINAL CODE TO COUNT KEYWORDS BY
MATCH TYPE
This is the original code
from the audit doc
@ChristiJOlson #pubcon
PULL IT TOGETHER & QA THE FINISHED PRODUCT
bit.ly/PI-KWDauditSCRIPT

PubCon Last Vegas 2015 - Editing AdWords Scripts