获取带有R的Adwords MCC的完整列表

问题描述 投票:-2回答:1

我需要通过Google API和R用Adwords帐户获取所有MCC的列表。到目前为止,我已经找到了一些软件包来获取单个MCC内所有clientID的列表,但没有找到示例来获取Adwords帐户内所有MCC的列表。

有人在这个主题上有经验吗?

到目前为止,我已经尝试过:

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)

代码最终出现此错误:

Warning message:
In parser(response) : x is not a valid managed.customer

我的帐户结构类似于:

  • 主MCC

    • 客户1(client_id_1)

      • Camp_#1
      • Camp_#2
    • 客户2(client_id_2)

      • Camp_#1
      • Camp_#2
    • 客户3(client_id_3)

      • Camp_#1
      • Camp_#2

如上所述,我的目标是获取所有client_id,以便为帐户中的每个客户收集数据

谢谢。

r google-adwords adwords-apiv201402
1个回答
0
投票

看起来JB已经在他的文档中回答了您的问题:

https://jburkhardt.github.io/RAdwords/faq/#list-account-ids

列出帐户ID

如何列出我的我的客户中心中的所有AdWords帐户ID?

我们很想实现此功能!不幸的是,Adwords API 报告服务不允许查询以下帐户信息 客户中心级别。

然而,好处是,您只需验证一次即可 访问您的“我的客户中心”内的所有帐户。最佳做法是创建一个 包含帐户ID的矢量,并在该矢量上循环。

示例如下:

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)
© www.soinside.com 2019 - 2024. All rights reserved.