Date post: | 16-Jul-2015 |
Category: |
Marketing |
Upload: | christi-olson |
View: | 546 times |
Download: | 5 times |
Christi Olson | @christijolson
Director of SEM | PointIt.com
A Non-Coders Guide to AdWords ScriptsIt’s not as intimidating as you have thought!
Steve Hammer | @armondhammer
Founder | RankHammer.com
ABOUT CHRISTI
@ar
mo
nd
ham
mer
#Her
oC
on
f
FUR BABIESFAMILY!RUN & CROSSFIT
POINT IT
Seattle Based Digital Marketing Agency
ABOUT STEVE
@ar
mo
nd
ham
mer
#Her
oC
on
f
FAMILYWhat it’s all about
FOOD AND
WINE
Eating as an art form?
HOCKEYGo Stars
RANKHAMMER
Dallas Based Internet Marketing Agency
@C
hri
stiJ
Ols
on
#H
ero
Co
nf
IT’S LIKE LEARNING A NEW LANGUAGE…
Structure TerminologyBasic rules
practice makes perfect
SCRIPTS ENABLE YOU TO
AUTOMATE all the things
THAT CAN BE DONE MANULLY IN ADWORDS
@C
hri
stiJ
Ols
on
#H
ero
Co
nf
Scripts can
MAKE CHANGES TO or REPORT ON
any element of an AdWords account.
Account or MCC LEVEL
@C
hri
stiJ
Ols
on
#H
ero
Co
nf
THE
UNKNOWNIS JAVASCRIPT.
It’s not part of the average SEM skill set.
@C
hri
stiJ
Ols
on
#H
ero
Co
nf
XLS VS JAVASCRIPT: CALCULATE CPA
JavaScript Formula:var D2 = 14539; var F2 = 254;
var calculate-cpa = (D2/F2);
return (calculate-cpa );
XLS Formula:where cells:D2 = $14,539F2 = 254
=D2/F2
@C
hri
stiJ
Ols
on
#H
ero
Co
nf
SELECT Data
FROM reference table
WHERE filter conditions
GROUP BY
aggregation
LIMIT # of records
SIMILAR TO JAVA, JUST A DIFFERENT LANGUAGE ENTITIES
OBJECTS
SELECTORS
LIMIT
NOTEPAD++ bit.ly/Notepad-plusplus
@C
hri
stiJ
Ols
on
#H
ero
Co
nf
• Outlines code
• Makes it easier to see what you are doing
@C
hri
stiJ
Ols
on
#H
ero
Co
nf
I LIKE COOKING MY FAMILY AND PETS
Use proper PUNCTUATION and STYLEthe lives it saves might be your family's
STYLE MATTERS WITH CODING
/* SINGLE FORWARD SLASH + ASTRIX*SIGNIFIES COMMENTS THAT SPAN MULTIPLE
LINES. *MULTI LINE COMMENTS END WITH */
(SLASH)
@C
hri
stiJ
Ols
on
#H
ero
Co
nf
// IS A SINGLE COMMENT LINE IN JAVASCRIPT
// comments can start anywhere in a line and javascript will skip to the end of the line// add as many or as few comments to your code explaining what it does
@C
hri
stiJ
Ols
on
#H
ero
Co
nf
SELECTOR
Makes an array of the typeFiltered by conditions
Finished with get();
@ar
mo
nd
ham
mer
#Her
oC
on
f
VARIABLES
Discreet
•5.23
•‘Office’
• 5+3
• ‘Today’ + variable
Arrays
• [4, 5, 7, 9]
•[‘Home’,’Office’,’Hotel’]
Objects
•{name:’Steve’,zip:75204,car:’Subaru’}
• {1:Array1,2:Array2}
ODD SELECTOR LOGIC
To make it flexible it has to be:“Column Operator” + Value
'Name = "' + var + '"'
@ar
mo
nd
ham
mer
SELECTABLE?
https://developers.google.com/adwords/scripts/docs/reference/adwordsapp/adwordsapp_adselector
@ar
mo
nd
ham
mer
#Her
oC
on
f
AVAILABLE METHODS
https://developers.google.com/adwords/scripts/docs/reference/adwordsapp/adwordsapp_ad
@ar
mo
nd
ham
mer
#Her
oC
on
f
TYPICAL CODE ARCHITECTURE
Global Variables – Used by all
Other Functions
Main Function
Local Variables
@ar
mo
nd
ham
mer
#Her
oC
on
f
DEFINING A FUNCTION
Functions can return values to feed a variable
Functions can also just be invoked, even without parameters
@ar
mo
nd
ham
mer
#Her
oC
on
f
SNIPPETS
https://developers.google.com/adwords/scripts/docs/examples/
@ar
mo
nd
ham
mer
#Her
oC
on
f
MORE JAVASCRIPT LESSONS
http://www.codecademy.com/tracks/javascripthttp://www.w3schools.com/js/default.asp
http://www.learn-js.org/
@ar
mo
nd
ham
mer
#Her
oC
on
f
@C
hri
stiJ
Ols
on
#H
ero
Co
nf
SCRIPTS YOU CAN USE NOW:
bit.ly/ScriptsToUse
•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)
• Account Audit, Written by Russ Savage (FreeAdwordsScripts.com)
• Search Query Manager, Written by Marcela De Vivo (Gryffin.com)
@C
hri
stiJ
Ols
on
#H
ero
Co
nf
RANKHAMMERS LIST OF AVAILABLE SCRIPTS:
bit.ly/1Ho3LFi
90+ Scripts in an XLS document
@C
hri
stiJ
Ols
on
#H
ero
Co
nf
SCRIPTS RESOURCES:
Optmyzr.com
FreeAdwordsScripts.com
▪ @RussellSavage
▪ @SiliconVallaeys
▪ @ArmondHammer
▪ @MarcelaDeVivo
▪ @BloomArty
▪ @SamuelDJames
@C
hri
stiJ
Ols
on
#H
ero
Co
nf
KEYWORD PERFORMANCE REPORTWanted to add 2 additional data points:Converted Clicks (CVR, CPA)• Conversion Value (ROAS)
stats.getConvertedClicks() workedstats.getConversionValue() kept giving me an error
getConversionValue() is not available with statsit has to be pulled via a separate type of report
@C
hri
stiJ
Ols
on
#H
ero
Co
nf
KEYWORD PERFORMANCE REPORTUpdated to include Converted Clicks• Converted Clicks (CVR, CPA)• Conversion Value (ROAS)
@C
hri
stiJ
Ols
on
#H
ero
Co
nf
• 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 = '[email protected]';
// URL of the default spreadsheet template. This should be a copy of http://goo.gl/cULxUXvar SPREADSHEET_URL = 'https://docs.google.com/spreadsheet/ccc?key=abc123#gid=0';
DON’T FORGET: UPDATE EMAIL/ URL (VAR)
@C
hri
stiJ
Ols
on
#H
ero
Co
nf
KEYWORD PERFORMANCE REPORT
Added to the additional columns to Headers
function outputQualityScoreData(sheet) {// Output header rowvar header = ['Quality Score','Num Keywords','Impressions','Clicks','CTR (%)','Cost','ConvertedClicks',
];sheet.getRange(3, 2, 1, 7).setValues([header]);
This is an ARRAY In this context it let you update specific data within a spreadsheet. You’re telling it where!getRange = (row to start on,
column to start on, number of rows to include,number of columns to include)
@C
hri
stiJ
Ols
on
#H
ero
Co
nf
KEYWORD PERFORMANCE REPORT
Added to the additional columns to Headers
function outputQualityScoreData(sheet) {// Output header rowvar header = ['Quality Score','Num Keywords','Impressions','Clicks','CTR (%)','Cost','ConvertedClicks',
];sheet.getRange(3, 2, 1, 7).setValues([header]);
I added 1 columnsIncrease # of columns from 6 to 7
Check for multiple instances of arrays within the script!
@C
hri
stiJ
Ols
on
#H
ero
Co
nf
KEYWORD PERFORMANCE REPORT
Added to the additional getStats()
// Compute datavar keywordIterator = AdWordsApp.keywords()
.forDateRange('LAST_WEEK')
.withCondition('Impressions > 0')
.get();while (keywordIterator.hasNext()) {var keyword = keywordIterator.next();var stats = keyword.getStatsFor('LAST_WEEK');var data = qualityScoreMap[keyword.getQualityScore()];if (data) {data.numKeywords++;data.totalImpressions += stats.getImpressions();data.totalClicks += stats.getClicks();data.totalCost += stats.getCost();data.totalConvertedClicks =+ stats.getConvertedClicks();
}}
this pulls in the total converted clicks into the column
@C
hri
stiJ
Ols
on
#H
ero
Co
nf
KEYWORD PERFORMANCE REPORT
YAY, it worked!Now I’ve got to figure out how to speed up our account audit processes!
GOAL: AUTOMATE AUDITING PROCESSES
@C
hri
stiJ
Ols
on
#H
ero
Co
nf
• Account set-up & settings
• SE Linked accounts audit
My Business / Local
Merchant Center
Google Analytics
Webmaster Tools
• Conversion tracking audit
• Goals & Events review
• Remarketing Audiences
• Shopping set-up
• Dynamic Search set-up
• Campaign settings & targeting
• Network settings & targeting
• Display settings & targeting
• Day Parting analysis
• Geo Targeting analysis
• Bid-modifier analysis
• Device Targeting analysis
• Ad delivery & rotation settings
• Ad extension audit
• Landing Page audit/analysis
• Campaign architecture
• Quality Score analysis
• Impression share analysis
• Keyword audit
• Negative keyword audit
• Match type audit
• Ad copy audit
• Display / Destination URL audit
• Missed Opportunity audit
• Performance audit
@C
hri
stiJ
Ols
on
#H
ero
Co
nf
I WANTED AN XLS SPREADSHEET
THAT WE COULD TRACK (AND MONITOR PROGRESS)
FOR ALL CLIENT ACCOUNTS
But for now…
Use the account audit script as a
frameworkto build out the more in-depth
audit
@C
hri
stiJ
Ols
on
#H
ero
Co
nf
@C
hri
stiJ
Ols
on
#H
ero
Co
nf
STEP 3: BREAK IT INTO BITE SIZED PIECES
1. Campaign & Ad Group Names
2. # of Keywords by Match Type & Negative
3. Location Targeting Audit
4. Extensions Audit
5. Budget Audit
@C
hri
stiJ
Ols
on
#H
ero
Co
nf
STEP 4: CREATE REUSABLE CODE
Create Header Rows within Spreadsheet
Start with Campaigns (because ad groups are within campaigns)
For Campaigns:Get Campaign NamesCalculate total KWDs & Negative KWDs
For Ad GroupsGet Ad Group NamesCalculate total KWDs & Negative KWDs
Push everything to the SpreadsheetLog 1 row per Campaign/Ad Group with Totals
@C
hri
stiJ
Ols
on
#H
ero
Co
nf
STEP 4:WRITE REUSABLE CODECAMPAIGN & AD GROUP ITERATORS
http://bit.ly/PI-GetCMP http://bit.ly/PI-GetAG
@C
hri
stiJ
Ols
on
#H
ero
Co
nf
STEP 4:WRITE REUSABLE CODECREATE & PUSH TO SPREADSHEET
bit.ly/PI-SpreadsheetScript
@C
hri
stiJ
Ols
on
#H
ero
Co
nf
STEP 5: WRITE/EDIT CODE COUNT KEYWORDS BY MATCH TYPE
This is the original code from the audit doc
CONNECT WITH US
SOCIAL NETWORKS
Rank Hammer
Downtown Dallas TX
214-720-0044
POINT IT
Downtown Seattle WA
206-673-3064
LOCATED
QUESTIONS
WEBSITE
@armondhammer@rankhammer@ChristiJOlson@point_it
rankhammer.compointit.com
linkedin.com/a/armondhammerlinkedin.com/in/ChristiJOlson
THE BASICS YOU NEED TO KNOW:
@C
hri
stiJ
Ols
on
#H
ero
Co
nf
OBJECTS……..… reference table
ENTITIES………. what your looking for
FUNCTIONS….. what the script is doing / formula
VARIABLES……. elements/items
METHODS……. how
SELECTORS..…. filters / refine results
ITERATORS…... find the next item (until there are no more)
LOGGERS…….. print the results
OBJECTS COLLECTION OF “ENTITIES”
AdWordsApp MccApp
SpreadsheetApp UrlFetchApp
ADWORDSACCOUNT
CONNECTS WITH SPREADSHEETS
(FOR REPORTING)
ACROSS YOUR MCC
COMMUNICATES WITH OTHER SERVICES &
APPLICATIONS
FUNCTIONS PERFORM TASKS / PROCEDURES
@C
hri
stiJ
Ols
on
#H
ero
Co
nf
{ } Curly Brackets define
the beginning & End of a Function
@C
hri
stiJ
Ols
on
#H
ero
Co
nf
VARIABLES (VAR) NAME & STORE DATA WITHIN SCRIPTS
Variable are like a container to store “data”
@C
hri
stiJ
Ols
on
#H
ero
Co
nf
ESTABLISH AN OBJECT AND SELECT AN ENTITY TO QUERY
var keywords = AdWordsApp.keywords()
ObjectNamed Variable Entity
Join an object and entity with a PERIOD
METHODS ARE HOW SCRIPTS INTERACT WITH OBJECTS
@C
hri
stiJ
Ols
on
#H
ero
Co
nf
• retrieve information about an object (what it is)
• ask an object about itself (what campaign a kwd is in)
• tell the object to do something (change status)
EXAMPLES OF METHODS
@C
hri
stiJ
Ols
on
#H
ero
Co
nf
getMaxCpc()
getQualityScore()
setDestinationURL()
when setting or specifying a values enter it between the brackets ()
some methods require values.
most are left blank ()
SELECTORS REFINE THE LIST OF ENTITIES
@C
hri
stiJ
Ols
on
#H
ero
Co
nf
• withCondition()
•withIds()
•forDateRange()
•orderBy()
•withLimit()
SELECTORS REFINE THE LIST OF ENTITIESAND CAN ORDER IT
@C
hri
stiJ
Ols
on
#H
ero
Co
nf
•withCondition()(‘Entity > N’); Greater than
(‘Entity <N’); Less than
• forDateRange()forDateRange(‘YESTERDAY’);
forDateRange(‘LAST_14_DAYS’);
•orderBy()(‘Entity ASC’); Ascending Order
(‘Entity DESC’); Descending Order
ITERATORS RETURN THE NEXT ITEM
@C
hri
stiJ
Ols
on
#H
ero
Co
nf
• like an array
• pattern based search
• come after selectors
hasNext()
objectNext()