Get full list of Adwords MCC with R
I need to get the list of all MCC with an Adwords account via Google API and R. So far I've found some packages to get the list of all clientID within a single MCC but I've found no example to get the list of all MCC within an Adwords account.
Do someone have experience on this topic?
So far I've tried:
library(RAdwordsPlus) library(RAdwords) google_auth <- doAuth() api_version <- "v201809" customer_id <- "MCC-MAIN-CODE" request <- RAdwordsPlus::managed.customer.request(fields = c("Name", "CustomerId")) r <- RAdwordsPlus::get.service(request = request, cid = customer_id, auth = google_auth, api.version = api_version, user.agent = "r-adwordsplus-test", verbose = FALSE, raw = FALSE, partial.failure = FALSE)
Code ended up with this error:
Warning message: In parser(response) : x is not a valid managed.customer
My Account structure is something like:
Main MCC
Customer 1 (client_id_1)
- Camp_#1
- Camp_#2
Customer 2 (client_id_2)
- Camp_#1
- Camp_#2
Customer 3 (client_id_3)
- Camp_#1
- Camp_#2
As stated, my goal will be to get all the client_id in order to gathering data for every Customer in the account
Thanks.
Looks like JB already answered your question in his docs at:
https://jburkhardt.github.io/RAdwords/faq/#list-account-ids
List account IDs
How to list all AdWords account IDs which are in my MCC?
We would love to implement this feature! Unfortunately the Adwords API reporting service does not allow to query the account information on client center level.
However the good is, you only need to authenticate once in order to access all accounts within your MCC. Best practice is to create a vector containing the account IDs and loop over the vector.
Example of that would be something like:
load('.google.auth.RData') adwords_accounts <- c( "495-862-1111", "613-408-2222", "564-802-3333", "902-758-4444", "536-035-5555", "708-304-6666", "429-737-7777", "532-474-8888") # account_performance <- statement(select= c('Date','AccountDescriptiveName','Cost','Clicks'), report="ACCOUNT_PERFORMANCE_REPORT", start="2019-01-01", end=as.character(Sys.Date())) # list_of_data <- lapply(adwords_accounts, function(x) getData(clientCustomerId = x, google_auth = google_auth, statement = account_performance)) adwords_data <- do.call(rbind,list_of_data)I've seen the code but, I don't think is 100% correct. I've got some python example where is it possible to get all client_id inside an MCC with API. Moreover, declaring an array with all the client code is exactly what I'm trying to avoid :-).
Just double checking but you've completed the steps around the API key required for Google Ads via API? jcchouinard.com/…
Of course, the various API-KEY's were tested on other languages/implementation