SlideShare a Scribd company logo
Google Inc. - All Rights Reserved
AdWords Scripts for MCC
Manage AdWords accounts using JavaScript
Mark Bowyer, Google, Inc.
Agenda
● Introduction
● Getting started
● Resources
● Questions
Google Inc. - All Rights Reserved
Introduction
Google Inc. - All Rights Reserved
● Way to programmatically access AdWords data
● Write your code in JavaScript
● Embedded IDE in AdWords UI
Recap - AdWords Scripts
Script
Google Inc. - All Rights Reserved
function main() {
// Retrieve campaign by name using AWQL.
var demoCampaign = AdWordsApp.campaigns().
withCondition("Name='Demo campaign'").get().next();
// Retrieve child adgroup using AWQL.
var demoAdGroup = demoCampaign.adGroups().
withCondition("Name='Demo adgroup'").get().next();
// Modify the adgroup properties.
demoAdGroup.setKeywordMaxCpc(1.2);
}
Recap - AdWords Scripts
Google Inc. - All Rights Reserved
● AdWords Scripts at MCC level
● Allows managing accounts at scale
What are MCC Scripts?
Google Inc. - All Rights Reserved
● Currently open for beta signup
● Whitelisting usually takes a few business days.
● Request whitelist at top-level MCC account
Availability
Google Inc. - All Rights Reserved
● Manage multiple client accounts from a single script
● No more copy-pasting a script into multiple accounts!
● Process multiple accounts in parallel
Benefits
Google Inc. - All Rights Reserved
● Bid management in all your child accounts
● Cross-account reporting
Common use cases
Google Inc. - All Rights Reserved
Accessing MCC Scripts
1
2
Google Inc. - All Rights Reserved
Get started!
Script
Google Inc. - All Rights Reserved
Your first script
function main() {
// Retrieve all the child accounts.
var accountIterator = MccApp.accounts().get();
// Iterate through the account list.
while (accountIterator.hasNext()) {
var account = accountIterator.next();
// Get stats for the child account.
var stats = account.getStatsFor("THIS_MONTH");
// And log it.
Logger.log("%s,%s,%s", account.getCustomerId(), stats.getClicks(),
stats.getImpressions(), stats.getCost());
}
}
Google Inc. - All Rights Reserved
● Provides account management functionality
● Retrieve child accounts
● Select a child account for further operations
● Process multiple child accounts in parallel
MccApp class
Google Inc. - All Rights Reserved
var accountIterator = MccApp.accounts().get();
● Use MccApp.accounts method
● By default, returns all client accounts (excluding sub-
MCCs)
Selecting child accounts
Script
Google Inc. - All Rights Reserved
● Can optionally filter by an account label
Selecting child accounts (cont’d)
var accountIterator = MccApp.accounts()
.withCondition('LabelName = "xxx"')
.get();
Script
Google Inc. - All Rights Reserved
● Can optionally take a list of client ids
Selecting child accounts (cont’d)
var accountIterator = MccApp.accounts()
.withIds(['123-456-7890', '345-678-9000'])
.get();
Script
Google Inc. - All Rights Reserved
● By default, this is the account where script resides
● Switch context using MccApp.select method
● Then use AdWordsApp class to process account
● Remember to switch back to your MCC account!
What account am I operating on?
Script
Google Inc. - All Rights Reserved
var childAccount = MccApp.accounts().withIds(["918-501-8835"])
.get().next();
// Save the MCC account.
var mccAccount = AdWordsApp.currentAccount();
// Select the child account
MccApp.select(childAccount);
// Process the account.
...
// Switch back to MCC account.
MccApp.select(mccAccount);
Operating on a specific child account (cont’d)
Google Inc. - All Rights Reserved
Processing accounts in parallel
Google Inc. - All Rights Reserved
● Use AccountSelector.executeInParallel
method
● Operate on upto 50 accounts in parallel
● Optional callback method after processing accounts
Operating on accounts in parallel
Script
Google Inc. - All Rights Reserved
function main() {
MccApp.accounts().executeInParallel("processAccount");
}
function processAccount() {
Logger.log("Operating on %s",
AdWordsApp.currentAccount().getCustomerId());
// Process the account.
// ...
return;
}
Operating on accounts in parallel (cont’d)
Script
Google Inc. - All Rights Reserved
function main() {
MccApp.accounts().executeInParallel("processAccount",
"allFinished");
}
function processAccount() {
...
}
function allFinished(results) {
...
}
Specifying a callback
Google Inc. - All Rights Reserved
● Use results argument of callback method
● Array of ExecutionResult objects
● One ExecutionResult per account processed
Analyzing the outcome...
Google Inc. - All Rights Reserved
● Contains
● CustomerId
● Status (Success, Error, Timeout)
● Error (if any)
● Return values from processAccount
Analyzing the outcome (cont’d)
Script
Google Inc. - All Rights Reserved
function processAccount() {
return AdWordsApp.campaigns().get().totalNumEntities().toString();
}
function allFinished(results) {
var totalCampaigns = 0;
for (var i = 0; i < results.length; i++) {
totalCampaigns += parseInt(results[i].getReturnValue());
}
Logger.log("There are %s campaigns under MCC ID: %s.",
totalCampaigns,
AdWordsApp.currentAccount().getCustomerId());
}
Returning processing results (cont’d)
Google Inc. - All Rights Reserved
● Processing method can return a string value
● Use JSON.stringify / JSON.parse to serialize / deserialize
complex objects
● Use datastore to return large values
● E.g. SpreadSheetApp, DriveApp...
Returning processing results (cont’d)
Google Inc. - All Rights Reserved
Execution time limits
30-Xmin
processAccount(A)
30
minutes
30minutes
30-Xmin
processAccount(C)
30-Xmin
processAccount(B)
main() method
calls executeInParallel() for
accounts A, B, C
allFinished()
Xminutes
1hour
Google Inc. - All Rights Reserved
● Signup form: https://services.google.
com/fb/forms/mccscripts
Beta signup
Google Inc. - All Rights Reserved
Resources
MccApp Documentation: http://goo.gl/r0pGJO
Feature guide: http://goo.gl/u65RAF
Code snippets: http://goo.gl/2BXrfo
Complete solutions: http://goo.gl/JSjYyf
Forum: http://goo.gl/sc95Q8
Google Inc. - All Rights Reserved
Questions?
Google Inc. - All Rights Reserved

More Related Content

Viewers also liked

AwReporting tool introduction (Spanish)
AwReporting tool introduction (Spanish)AwReporting tool introduction (Spanish)
AwReporting tool introduction (Spanish)
marcwan
 
AdWords API & OAuth 2.0, Advanced
AdWords API & OAuth 2.0, Advanced AdWords API & OAuth 2.0, Advanced
AdWords API & OAuth 2.0, Advanced
marcwan
 
AwReporting Tool
AwReporting ToolAwReporting Tool
AwReporting Tool
marcwan
 
Getting Started with AdWords API and Google Analytics
Getting Started with AdWords API and Google AnalyticsGetting Started with AdWords API and Google Analytics
Getting Started with AdWords API and Google Analytics
marcwan
 
Bid Estimation with the AdWords API (v2)
Bid Estimation with the AdWords API (v2)Bid Estimation with the AdWords API (v2)
Bid Estimation with the AdWords API (v2)
marcwan
 
Google Data Studio 360 Tutorial
Google Data Studio 360 TutorialGoogle Data Studio 360 Tutorial
Google Data Studio 360 Tutorial
Veeranjaneyulu CH
 

Viewers also liked (6)

AwReporting tool introduction (Spanish)
AwReporting tool introduction (Spanish)AwReporting tool introduction (Spanish)
AwReporting tool introduction (Spanish)
 
AdWords API & OAuth 2.0, Advanced
AdWords API & OAuth 2.0, Advanced AdWords API & OAuth 2.0, Advanced
AdWords API & OAuth 2.0, Advanced
 
AwReporting Tool
AwReporting ToolAwReporting Tool
AwReporting Tool
 
Getting Started with AdWords API and Google Analytics
Getting Started with AdWords API and Google AnalyticsGetting Started with AdWords API and Google Analytics
Getting Started with AdWords API and Google Analytics
 
Bid Estimation with the AdWords API (v2)
Bid Estimation with the AdWords API (v2)Bid Estimation with the AdWords API (v2)
Bid Estimation with the AdWords API (v2)
 
Google Data Studio 360 Tutorial
Google Data Studio 360 TutorialGoogle Data Studio 360 Tutorial
Google Data Studio 360 Tutorial
 

Similar to AdWords Scripts and MCC Scripting

MCC Scripts update
MCC Scripts updateMCC Scripts update
MCC Scripts update
supergigas
 
Gae
GaeGae
Google Cloud Platform 2014Q1 - Starter Guide
Google Cloud Platform   2014Q1 - Starter GuideGoogle Cloud Platform   2014Q1 - Starter Guide
Google Cloud Platform 2014Q1 - Starter Guide
Simon Su
 
OpenCms Days 2014 - User Generated Content in OpenCms 9.5
OpenCms Days 2014 - User Generated Content in OpenCms 9.5OpenCms Days 2014 - User Generated Content in OpenCms 9.5
OpenCms Days 2014 - User Generated Content in OpenCms 9.5
Alkacon Software GmbH & Co. KG
 
Benefits of Google Tag Manager
Benefits of Google Tag ManagerBenefits of Google Tag Manager
Benefits of Google Tag Manager
Phil Pearce
 
Refatorando com a API funcional do Java
Refatorando com a API funcional do JavaRefatorando com a API funcional do Java
Refatorando com a API funcional do Java
Giovane Liberato
 
Google Optimize for testing and personalization
Google Optimize for testing and personalizationGoogle Optimize for testing and personalization
Google Optimize for testing and personalization
OWOX BI
 
Dependency injection - the right way
Dependency injection - the right wayDependency injection - the right way
Dependency injection - the right way
Thibaud Desodt
 
Cómo usar google analytics
Cómo usar google analyticsCómo usar google analytics
Cómo usar google analytics
Paradigma Digital
 
BatchJobService
BatchJobServiceBatchJobService
BatchJobService
supergigas
 
Get Ready to Become Google Associate Cloud Engineer
Get Ready to Become Google Associate Cloud EngineerGet Ready to Become Google Associate Cloud Engineer
Get Ready to Become Google Associate Cloud Engineer
Amaaira Johns
 
Java: Class Design Examples
Java: Class Design ExamplesJava: Class Design Examples
Java: Class Design Examples
Tareq Hasan
 
Building the an End-to-End ASP.NET MVC 4, Entity Framework, HTML5, jQuery app...
Building the an End-to-End ASP.NET MVC 4, Entity Framework, HTML5, jQuery app...Building the an End-to-End ASP.NET MVC 4, Entity Framework, HTML5, jQuery app...
Building the an End-to-End ASP.NET MVC 4, Entity Framework, HTML5, jQuery app...
Dan Wahlin
 
Windows Store app using XAML and C#: Enterprise Product Development
Windows Store app using XAML and C#: Enterprise Product Development Windows Store app using XAML and C#: Enterprise Product Development
Windows Store app using XAML and C#: Enterprise Product Development
Mahmoud Hamed Mahmoud
 
Image archive, analysis & report generation with Google Cloud
Image archive, analysis & report generation with Google CloudImage archive, analysis & report generation with Google Cloud
Image archive, analysis & report generation with Google Cloud
wesley chun
 
Week 8
Week 8Week 8
Week 8
A VD
 
Let's your users share your App with Friends: App Invites for Android
 Let's your users share your App with Friends: App Invites for Android Let's your users share your App with Friends: App Invites for Android
Let's your users share your App with Friends: App Invites for Android
Wilfried Mbouenda Mbogne
 
From SF with Love
From SF with LoveFrom SF with Love
From SF with Love
OpenSistemas
 
CGI::Prototype (NPW 2006)
CGI::Prototype (NPW 2006)CGI::Prototype (NPW 2006)
CGI::Prototype (NPW 2006)
brian d foy
 
How to Pass the Google Analytics Individual Qualification Test by Slingshot SEO
How to Pass the  Google Analytics Individual Qualification Test by Slingshot SEOHow to Pass the  Google Analytics Individual Qualification Test by Slingshot SEO
How to Pass the Google Analytics Individual Qualification Test by Slingshot SEO
Aarif Nazir
 

Similar to AdWords Scripts and MCC Scripting (20)

MCC Scripts update
MCC Scripts updateMCC Scripts update
MCC Scripts update
 
Gae
GaeGae
Gae
 
Google Cloud Platform 2014Q1 - Starter Guide
Google Cloud Platform   2014Q1 - Starter GuideGoogle Cloud Platform   2014Q1 - Starter Guide
Google Cloud Platform 2014Q1 - Starter Guide
 
OpenCms Days 2014 - User Generated Content in OpenCms 9.5
OpenCms Days 2014 - User Generated Content in OpenCms 9.5OpenCms Days 2014 - User Generated Content in OpenCms 9.5
OpenCms Days 2014 - User Generated Content in OpenCms 9.5
 
Benefits of Google Tag Manager
Benefits of Google Tag ManagerBenefits of Google Tag Manager
Benefits of Google Tag Manager
 
Refatorando com a API funcional do Java
Refatorando com a API funcional do JavaRefatorando com a API funcional do Java
Refatorando com a API funcional do Java
 
Google Optimize for testing and personalization
Google Optimize for testing and personalizationGoogle Optimize for testing and personalization
Google Optimize for testing and personalization
 
Dependency injection - the right way
Dependency injection - the right wayDependency injection - the right way
Dependency injection - the right way
 
Cómo usar google analytics
Cómo usar google analyticsCómo usar google analytics
Cómo usar google analytics
 
BatchJobService
BatchJobServiceBatchJobService
BatchJobService
 
Get Ready to Become Google Associate Cloud Engineer
Get Ready to Become Google Associate Cloud EngineerGet Ready to Become Google Associate Cloud Engineer
Get Ready to Become Google Associate Cloud Engineer
 
Java: Class Design Examples
Java: Class Design ExamplesJava: Class Design Examples
Java: Class Design Examples
 
Building the an End-to-End ASP.NET MVC 4, Entity Framework, HTML5, jQuery app...
Building the an End-to-End ASP.NET MVC 4, Entity Framework, HTML5, jQuery app...Building the an End-to-End ASP.NET MVC 4, Entity Framework, HTML5, jQuery app...
Building the an End-to-End ASP.NET MVC 4, Entity Framework, HTML5, jQuery app...
 
Windows Store app using XAML and C#: Enterprise Product Development
Windows Store app using XAML and C#: Enterprise Product Development Windows Store app using XAML and C#: Enterprise Product Development
Windows Store app using XAML and C#: Enterprise Product Development
 
Image archive, analysis & report generation with Google Cloud
Image archive, analysis & report generation with Google CloudImage archive, analysis & report generation with Google Cloud
Image archive, analysis & report generation with Google Cloud
 
Week 8
Week 8Week 8
Week 8
 
Let's your users share your App with Friends: App Invites for Android
 Let's your users share your App with Friends: App Invites for Android Let's your users share your App with Friends: App Invites for Android
Let's your users share your App with Friends: App Invites for Android
 
From SF with Love
From SF with LoveFrom SF with Love
From SF with Love
 
CGI::Prototype (NPW 2006)
CGI::Prototype (NPW 2006)CGI::Prototype (NPW 2006)
CGI::Prototype (NPW 2006)
 
How to Pass the Google Analytics Individual Qualification Test by Slingshot SEO
How to Pass the  Google Analytics Individual Qualification Test by Slingshot SEOHow to Pass the  Google Analytics Individual Qualification Test by Slingshot SEO
How to Pass the Google Analytics Individual Qualification Test by Slingshot SEO
 

More from marcwan

Mcc scripts deck (日本語)
Mcc scripts deck (日本語)Mcc scripts deck (日本語)
Mcc scripts deck (日本語)
marcwan
 
Shopping Campaigns and AdWords API
Shopping Campaigns and AdWords APIShopping Campaigns and AdWords API
Shopping Campaigns and AdWords API
marcwan
 
API Updates for v201402
API Updates for v201402API Updates for v201402
API Updates for v201402
marcwan
 
AdWords API Targeting Options
AdWords API Targeting OptionsAdWords API Targeting Options
AdWords API Targeting Options
marcwan
 
OAuth 2.0 (Spanish)
OAuth 2.0 (Spanish)OAuth 2.0 (Spanish)
OAuth 2.0 (Spanish)
marcwan
 
End to-end how to build a platform (Spanish)
End to-end how to build a platform (Spanish)End to-end how to build a platform (Spanish)
End to-end how to build a platform (Spanish)
marcwan
 
Api update rundown (Spanish)
Api update rundown (Spanish)Api update rundown (Spanish)
Api update rundown (Spanish)
marcwan
 
AdWords Scripts (Spanish)
AdWords Scripts (Spanish)AdWords Scripts (Spanish)
AdWords Scripts (Spanish)
marcwan
 
Mobile landing pages (Spanish)
Mobile landing pages (Spanish)Mobile landing pages (Spanish)
Mobile landing pages (Spanish)
marcwan
 
Rate limits and performance
Rate limits and performanceRate limits and performance
Rate limits and performance
marcwan
 
OAuth 2.0 refresher
OAuth 2.0 refresherOAuth 2.0 refresher
OAuth 2.0 refresher
marcwan
 
Mobile landing pages
Mobile landing pagesMobile landing pages
Mobile landing pages
marcwan
 
End to-end how to build a platform
End to-end how to build a platformEnd to-end how to build a platform
End to-end how to build a platform
marcwan
 
AwReporting Tool
AwReporting ToolAwReporting Tool
AwReporting Tool
marcwan
 
Api update rundown
Api update rundownApi update rundown
Api update rundown
marcwan
 
AdWords Scripts
AdWords ScriptsAdWords Scripts
AdWords Scripts
marcwan
 
Reporting tips & tricks
Reporting tips & tricksReporting tips & tricks
Reporting tips & tricks
marcwan
 
Reporting tips & tricks (russian)
Reporting tips & tricks (russian)Reporting tips & tricks (russian)
Reporting tips & tricks (russian)marcwan
 
Rate limits and performance (russian)
Rate limits and performance (russian)Rate limits and performance (russian)
Rate limits and performance (russian)marcwan
 

More from marcwan (19)

Mcc scripts deck (日本語)
Mcc scripts deck (日本語)Mcc scripts deck (日本語)
Mcc scripts deck (日本語)
 
Shopping Campaigns and AdWords API
Shopping Campaigns and AdWords APIShopping Campaigns and AdWords API
Shopping Campaigns and AdWords API
 
API Updates for v201402
API Updates for v201402API Updates for v201402
API Updates for v201402
 
AdWords API Targeting Options
AdWords API Targeting OptionsAdWords API Targeting Options
AdWords API Targeting Options
 
OAuth 2.0 (Spanish)
OAuth 2.0 (Spanish)OAuth 2.0 (Spanish)
OAuth 2.0 (Spanish)
 
End to-end how to build a platform (Spanish)
End to-end how to build a platform (Spanish)End to-end how to build a platform (Spanish)
End to-end how to build a platform (Spanish)
 
Api update rundown (Spanish)
Api update rundown (Spanish)Api update rundown (Spanish)
Api update rundown (Spanish)
 
AdWords Scripts (Spanish)
AdWords Scripts (Spanish)AdWords Scripts (Spanish)
AdWords Scripts (Spanish)
 
Mobile landing pages (Spanish)
Mobile landing pages (Spanish)Mobile landing pages (Spanish)
Mobile landing pages (Spanish)
 
Rate limits and performance
Rate limits and performanceRate limits and performance
Rate limits and performance
 
OAuth 2.0 refresher
OAuth 2.0 refresherOAuth 2.0 refresher
OAuth 2.0 refresher
 
Mobile landing pages
Mobile landing pagesMobile landing pages
Mobile landing pages
 
End to-end how to build a platform
End to-end how to build a platformEnd to-end how to build a platform
End to-end how to build a platform
 
AwReporting Tool
AwReporting ToolAwReporting Tool
AwReporting Tool
 
Api update rundown
Api update rundownApi update rundown
Api update rundown
 
AdWords Scripts
AdWords ScriptsAdWords Scripts
AdWords Scripts
 
Reporting tips & tricks
Reporting tips & tricksReporting tips & tricks
Reporting tips & tricks
 
Reporting tips & tricks (russian)
Reporting tips & tricks (russian)Reporting tips & tricks (russian)
Reporting tips & tricks (russian)
 
Rate limits and performance (russian)
Rate limits and performance (russian)Rate limits and performance (russian)
Rate limits and performance (russian)
 

Recently uploaded

Deep Dive: AI-Powered Marketing to Get More Leads and Customers with HyperGro...
Deep Dive: AI-Powered Marketing to Get More Leads and Customers with HyperGro...Deep Dive: AI-Powered Marketing to Get More Leads and Customers with HyperGro...
Deep Dive: AI-Powered Marketing to Get More Leads and Customers with HyperGro...
saastr
 
Monitoring and Managing Anomaly Detection on OpenShift.pdf
Monitoring and Managing Anomaly Detection on OpenShift.pdfMonitoring and Managing Anomaly Detection on OpenShift.pdf
Monitoring and Managing Anomaly Detection on OpenShift.pdf
Tosin Akinosho
 
Astute Business Solutions | Oracle Cloud Partner |
Astute Business Solutions | Oracle Cloud Partner |Astute Business Solutions | Oracle Cloud Partner |
Astute Business Solutions | Oracle Cloud Partner |
AstuteBusiness
 
Let's Integrate MuleSoft RPA, COMPOSER, APM with AWS IDP along with Slack
Let's Integrate MuleSoft RPA, COMPOSER, APM with AWS IDP along with SlackLet's Integrate MuleSoft RPA, COMPOSER, APM with AWS IDP along with Slack
Let's Integrate MuleSoft RPA, COMPOSER, APM with AWS IDP along with Slack
shyamraj55
 
Driving Business Innovation: Latest Generative AI Advancements & Success Story
Driving Business Innovation: Latest Generative AI Advancements & Success StoryDriving Business Innovation: Latest Generative AI Advancements & Success Story
Driving Business Innovation: Latest Generative AI Advancements & Success Story
Safe Software
 
Public CyberSecurity Awareness Presentation 2024.pptx
Public CyberSecurity Awareness Presentation 2024.pptxPublic CyberSecurity Awareness Presentation 2024.pptx
Public CyberSecurity Awareness Presentation 2024.pptx
marufrahmanstratejm
 
Azure API Management to expose backend services securely
Azure API Management to expose backend services securelyAzure API Management to expose backend services securely
Azure API Management to expose backend services securely
Dinusha Kumarasiri
 
Serial Arm Control in Real Time Presentation
Serial Arm Control in Real Time PresentationSerial Arm Control in Real Time Presentation
Serial Arm Control in Real Time Presentation
tolgahangng
 
FREE A4 Cyber Security Awareness Posters-Social Engineering part 3
FREE A4 Cyber Security Awareness  Posters-Social Engineering part 3FREE A4 Cyber Security Awareness  Posters-Social Engineering part 3
FREE A4 Cyber Security Awareness Posters-Social Engineering part 3
Data Hops
 
Freshworks Rethinks NoSQL for Rapid Scaling & Cost-Efficiency
Freshworks Rethinks NoSQL for Rapid Scaling & Cost-EfficiencyFreshworks Rethinks NoSQL for Rapid Scaling & Cost-Efficiency
Freshworks Rethinks NoSQL for Rapid Scaling & Cost-Efficiency
ScyllaDB
 
Nordic Marketo Engage User Group_June 13_ 2024.pptx
Nordic Marketo Engage User Group_June 13_ 2024.pptxNordic Marketo Engage User Group_June 13_ 2024.pptx
Nordic Marketo Engage User Group_June 13_ 2024.pptx
MichaelKnudsen27
 
SAP S/4 HANA sourcing and procurement to Public cloud
SAP S/4 HANA sourcing and procurement to Public cloudSAP S/4 HANA sourcing and procurement to Public cloud
SAP S/4 HANA sourcing and procurement to Public cloud
maazsz111
 
How to Interpret Trends in the Kalyan Rajdhani Mix Chart.pdf
How to Interpret Trends in the Kalyan Rajdhani Mix Chart.pdfHow to Interpret Trends in the Kalyan Rajdhani Mix Chart.pdf
How to Interpret Trends in the Kalyan Rajdhani Mix Chart.pdf
Chart Kalyan
 
Energy Efficient Video Encoding for Cloud and Edge Computing Instances
Energy Efficient Video Encoding for Cloud and Edge Computing InstancesEnergy Efficient Video Encoding for Cloud and Edge Computing Instances
Energy Efficient Video Encoding for Cloud and Edge Computing Instances
Alpen-Adria-Universität
 
Columbus Data & Analytics Wednesdays - June 2024
Columbus Data & Analytics Wednesdays - June 2024Columbus Data & Analytics Wednesdays - June 2024
Columbus Data & Analytics Wednesdays - June 2024
Jason Packer
 
JavaLand 2024: Application Development Green Masterplan
JavaLand 2024: Application Development Green MasterplanJavaLand 2024: Application Development Green Masterplan
JavaLand 2024: Application Development Green Masterplan
Miro Wengner
 
Your One-Stop Shop for Python Success: Top 10 US Python Development Providers
Your One-Stop Shop for Python Success: Top 10 US Python Development ProvidersYour One-Stop Shop for Python Success: Top 10 US Python Development Providers
Your One-Stop Shop for Python Success: Top 10 US Python Development Providers
akankshawande
 
Introduction of Cybersecurity with OSS at Code Europe 2024
Introduction of Cybersecurity with OSS  at Code Europe 2024Introduction of Cybersecurity with OSS  at Code Europe 2024
Introduction of Cybersecurity with OSS at Code Europe 2024
Hiroshi SHIBATA
 
GNSS spoofing via SDR (Criptored Talks 2024)
GNSS spoofing via SDR (Criptored Talks 2024)GNSS spoofing via SDR (Criptored Talks 2024)
GNSS spoofing via SDR (Criptored Talks 2024)
Javier Junquera
 
5th LF Energy Power Grid Model Meet-up Slides
5th LF Energy Power Grid Model Meet-up Slides5th LF Energy Power Grid Model Meet-up Slides
5th LF Energy Power Grid Model Meet-up Slides
DanBrown980551
 

Recently uploaded (20)

Deep Dive: AI-Powered Marketing to Get More Leads and Customers with HyperGro...
Deep Dive: AI-Powered Marketing to Get More Leads and Customers with HyperGro...Deep Dive: AI-Powered Marketing to Get More Leads and Customers with HyperGro...
Deep Dive: AI-Powered Marketing to Get More Leads and Customers with HyperGro...
 
Monitoring and Managing Anomaly Detection on OpenShift.pdf
Monitoring and Managing Anomaly Detection on OpenShift.pdfMonitoring and Managing Anomaly Detection on OpenShift.pdf
Monitoring and Managing Anomaly Detection on OpenShift.pdf
 
Astute Business Solutions | Oracle Cloud Partner |
Astute Business Solutions | Oracle Cloud Partner |Astute Business Solutions | Oracle Cloud Partner |
Astute Business Solutions | Oracle Cloud Partner |
 
Let's Integrate MuleSoft RPA, COMPOSER, APM with AWS IDP along with Slack
Let's Integrate MuleSoft RPA, COMPOSER, APM with AWS IDP along with SlackLet's Integrate MuleSoft RPA, COMPOSER, APM with AWS IDP along with Slack
Let's Integrate MuleSoft RPA, COMPOSER, APM with AWS IDP along with Slack
 
Driving Business Innovation: Latest Generative AI Advancements & Success Story
Driving Business Innovation: Latest Generative AI Advancements & Success StoryDriving Business Innovation: Latest Generative AI Advancements & Success Story
Driving Business Innovation: Latest Generative AI Advancements & Success Story
 
Public CyberSecurity Awareness Presentation 2024.pptx
Public CyberSecurity Awareness Presentation 2024.pptxPublic CyberSecurity Awareness Presentation 2024.pptx
Public CyberSecurity Awareness Presentation 2024.pptx
 
Azure API Management to expose backend services securely
Azure API Management to expose backend services securelyAzure API Management to expose backend services securely
Azure API Management to expose backend services securely
 
Serial Arm Control in Real Time Presentation
Serial Arm Control in Real Time PresentationSerial Arm Control in Real Time Presentation
Serial Arm Control in Real Time Presentation
 
FREE A4 Cyber Security Awareness Posters-Social Engineering part 3
FREE A4 Cyber Security Awareness  Posters-Social Engineering part 3FREE A4 Cyber Security Awareness  Posters-Social Engineering part 3
FREE A4 Cyber Security Awareness Posters-Social Engineering part 3
 
Freshworks Rethinks NoSQL for Rapid Scaling & Cost-Efficiency
Freshworks Rethinks NoSQL for Rapid Scaling & Cost-EfficiencyFreshworks Rethinks NoSQL for Rapid Scaling & Cost-Efficiency
Freshworks Rethinks NoSQL for Rapid Scaling & Cost-Efficiency
 
Nordic Marketo Engage User Group_June 13_ 2024.pptx
Nordic Marketo Engage User Group_June 13_ 2024.pptxNordic Marketo Engage User Group_June 13_ 2024.pptx
Nordic Marketo Engage User Group_June 13_ 2024.pptx
 
SAP S/4 HANA sourcing and procurement to Public cloud
SAP S/4 HANA sourcing and procurement to Public cloudSAP S/4 HANA sourcing and procurement to Public cloud
SAP S/4 HANA sourcing and procurement to Public cloud
 
How to Interpret Trends in the Kalyan Rajdhani Mix Chart.pdf
How to Interpret Trends in the Kalyan Rajdhani Mix Chart.pdfHow to Interpret Trends in the Kalyan Rajdhani Mix Chart.pdf
How to Interpret Trends in the Kalyan Rajdhani Mix Chart.pdf
 
Energy Efficient Video Encoding for Cloud and Edge Computing Instances
Energy Efficient Video Encoding for Cloud and Edge Computing InstancesEnergy Efficient Video Encoding for Cloud and Edge Computing Instances
Energy Efficient Video Encoding for Cloud and Edge Computing Instances
 
Columbus Data & Analytics Wednesdays - June 2024
Columbus Data & Analytics Wednesdays - June 2024Columbus Data & Analytics Wednesdays - June 2024
Columbus Data & Analytics Wednesdays - June 2024
 
JavaLand 2024: Application Development Green Masterplan
JavaLand 2024: Application Development Green MasterplanJavaLand 2024: Application Development Green Masterplan
JavaLand 2024: Application Development Green Masterplan
 
Your One-Stop Shop for Python Success: Top 10 US Python Development Providers
Your One-Stop Shop for Python Success: Top 10 US Python Development ProvidersYour One-Stop Shop for Python Success: Top 10 US Python Development Providers
Your One-Stop Shop for Python Success: Top 10 US Python Development Providers
 
Introduction of Cybersecurity with OSS at Code Europe 2024
Introduction of Cybersecurity with OSS  at Code Europe 2024Introduction of Cybersecurity with OSS  at Code Europe 2024
Introduction of Cybersecurity with OSS at Code Europe 2024
 
GNSS spoofing via SDR (Criptored Talks 2024)
GNSS spoofing via SDR (Criptored Talks 2024)GNSS spoofing via SDR (Criptored Talks 2024)
GNSS spoofing via SDR (Criptored Talks 2024)
 
5th LF Energy Power Grid Model Meet-up Slides
5th LF Energy Power Grid Model Meet-up Slides5th LF Energy Power Grid Model Meet-up Slides
5th LF Energy Power Grid Model Meet-up Slides
 

AdWords Scripts and MCC Scripting

  • 1. Google Inc. - All Rights Reserved
  • 2. AdWords Scripts for MCC Manage AdWords accounts using JavaScript Mark Bowyer, Google, Inc.
  • 3. Agenda ● Introduction ● Getting started ● Resources ● Questions
  • 4. Google Inc. - All Rights Reserved Introduction
  • 5. Google Inc. - All Rights Reserved ● Way to programmatically access AdWords data ● Write your code in JavaScript ● Embedded IDE in AdWords UI Recap - AdWords Scripts
  • 6. Script Google Inc. - All Rights Reserved function main() { // Retrieve campaign by name using AWQL. var demoCampaign = AdWordsApp.campaigns(). withCondition("Name='Demo campaign'").get().next(); // Retrieve child adgroup using AWQL. var demoAdGroup = demoCampaign.adGroups(). withCondition("Name='Demo adgroup'").get().next(); // Modify the adgroup properties. demoAdGroup.setKeywordMaxCpc(1.2); } Recap - AdWords Scripts
  • 7. Google Inc. - All Rights Reserved ● AdWords Scripts at MCC level ● Allows managing accounts at scale What are MCC Scripts?
  • 8. Google Inc. - All Rights Reserved ● Currently open for beta signup ● Whitelisting usually takes a few business days. ● Request whitelist at top-level MCC account Availability
  • 9. Google Inc. - All Rights Reserved ● Manage multiple client accounts from a single script ● No more copy-pasting a script into multiple accounts! ● Process multiple accounts in parallel Benefits
  • 10. Google Inc. - All Rights Reserved ● Bid management in all your child accounts ● Cross-account reporting Common use cases
  • 11. Google Inc. - All Rights Reserved Accessing MCC Scripts 1 2
  • 12. Google Inc. - All Rights Reserved Get started!
  • 13. Script Google Inc. - All Rights Reserved Your first script function main() { // Retrieve all the child accounts. var accountIterator = MccApp.accounts().get(); // Iterate through the account list. while (accountIterator.hasNext()) { var account = accountIterator.next(); // Get stats for the child account. var stats = account.getStatsFor("THIS_MONTH"); // And log it. Logger.log("%s,%s,%s", account.getCustomerId(), stats.getClicks(), stats.getImpressions(), stats.getCost()); } }
  • 14. Google Inc. - All Rights Reserved ● Provides account management functionality ● Retrieve child accounts ● Select a child account for further operations ● Process multiple child accounts in parallel MccApp class
  • 15. Google Inc. - All Rights Reserved var accountIterator = MccApp.accounts().get(); ● Use MccApp.accounts method ● By default, returns all client accounts (excluding sub- MCCs) Selecting child accounts Script
  • 16. Google Inc. - All Rights Reserved ● Can optionally filter by an account label Selecting child accounts (cont’d) var accountIterator = MccApp.accounts() .withCondition('LabelName = "xxx"') .get(); Script
  • 17. Google Inc. - All Rights Reserved ● Can optionally take a list of client ids Selecting child accounts (cont’d) var accountIterator = MccApp.accounts() .withIds(['123-456-7890', '345-678-9000']) .get(); Script
  • 18. Google Inc. - All Rights Reserved ● By default, this is the account where script resides ● Switch context using MccApp.select method ● Then use AdWordsApp class to process account ● Remember to switch back to your MCC account! What account am I operating on?
  • 19. Script Google Inc. - All Rights Reserved var childAccount = MccApp.accounts().withIds(["918-501-8835"]) .get().next(); // Save the MCC account. var mccAccount = AdWordsApp.currentAccount(); // Select the child account MccApp.select(childAccount); // Process the account. ... // Switch back to MCC account. MccApp.select(mccAccount); Operating on a specific child account (cont’d)
  • 20. Google Inc. - All Rights Reserved Processing accounts in parallel
  • 21. Google Inc. - All Rights Reserved ● Use AccountSelector.executeInParallel method ● Operate on upto 50 accounts in parallel ● Optional callback method after processing accounts Operating on accounts in parallel
  • 22. Script Google Inc. - All Rights Reserved function main() { MccApp.accounts().executeInParallel("processAccount"); } function processAccount() { Logger.log("Operating on %s", AdWordsApp.currentAccount().getCustomerId()); // Process the account. // ... return; } Operating on accounts in parallel (cont’d)
  • 23. Script Google Inc. - All Rights Reserved function main() { MccApp.accounts().executeInParallel("processAccount", "allFinished"); } function processAccount() { ... } function allFinished(results) { ... } Specifying a callback
  • 24. Google Inc. - All Rights Reserved ● Use results argument of callback method ● Array of ExecutionResult objects ● One ExecutionResult per account processed Analyzing the outcome...
  • 25. Google Inc. - All Rights Reserved ● Contains ● CustomerId ● Status (Success, Error, Timeout) ● Error (if any) ● Return values from processAccount Analyzing the outcome (cont’d)
  • 26. Script Google Inc. - All Rights Reserved function processAccount() { return AdWordsApp.campaigns().get().totalNumEntities().toString(); } function allFinished(results) { var totalCampaigns = 0; for (var i = 0; i < results.length; i++) { totalCampaigns += parseInt(results[i].getReturnValue()); } Logger.log("There are %s campaigns under MCC ID: %s.", totalCampaigns, AdWordsApp.currentAccount().getCustomerId()); } Returning processing results (cont’d)
  • 27. Google Inc. - All Rights Reserved ● Processing method can return a string value ● Use JSON.stringify / JSON.parse to serialize / deserialize complex objects ● Use datastore to return large values ● E.g. SpreadSheetApp, DriveApp... Returning processing results (cont’d)
  • 28. Google Inc. - All Rights Reserved Execution time limits 30-Xmin processAccount(A) 30 minutes 30minutes 30-Xmin processAccount(C) 30-Xmin processAccount(B) main() method calls executeInParallel() for accounts A, B, C allFinished() Xminutes 1hour
  • 29. Google Inc. - All Rights Reserved ● Signup form: https://services.google. com/fb/forms/mccscripts Beta signup
  • 30. Google Inc. - All Rights Reserved Resources MccApp Documentation: http://goo.gl/r0pGJO Feature guide: http://goo.gl/u65RAF Code snippets: http://goo.gl/2BXrfo Complete solutions: http://goo.gl/JSjYyf Forum: http://goo.gl/sc95Q8
  • 31. Google Inc. - All Rights Reserved Questions?
  • 32. Google Inc. - All Rights Reserved