将 Adwords 流量估算器服务与 R /“Adwords”包一起使用
Using the Adwords Traffic Estimator Service with R / ‘RAdwords’ packege
所以我需要通过 Google Adwords 获取某些关键字的流量估算。我看到 Google 有一个流量估算服务 API: https://developers.google.com/adwords/api/docs/guides/traffic-estimator-service .
我正在使用 R,它有一个非常全面的 RAdwords 包,https://jburkhardt.github.io/RAdwords/faq/,但是我很遗憾地没有找到它提供对这个特定 Adwords API 服务的访问的天气。
那么有人使用 R 通过流量估算器从 Google adwords 获取关键字数据吗?是否可以使用 RAdwords packege 或是否需要通过经典脚本来完成?
提前致谢。
有一个名为 RAdwordsPlus 的 R 包,它建立在 RAdwords 之上,可以做到这一点。
devtools::install_github("adviso/RAdwordsPlus")
library(RAdwordsPlus)
google_auth <- doAuth() # requires user interaction the first time
api_version <- "v201809"
customer_id <- "xxx-xxx-xxxx"
# Build keyword request
k <- keyword(
text = c("mars cruise", "cheap cruise", "cruise"),
match.type = c("BROAD", "PHRASE", "EXACT"),
type = "Keyword"
)
# Keyword estimate request
ker <- keyword.estimate.request(
keyword = k,
max.cpc = 5000000, # 1 million == one unit (microamaounts)
is.negative = FALSE
)
# AdGroupEstimateRequest
aer <- adgroup.estimate.request(ker)
# Criteria for CampaignEstimateRequest
cer_criteria <- vector("list", length = 2)
cer_criteria[[1]] <- as.criterion(id = "2826", type = "Location") # united kingdom
cer_criteria[[2]] <- as.criterion(id = "1000", type = "Language") # english
# CampaignEstimateRequest
cer <- campaign.estimate.request(aer, campaign.id = NULL, criteria = cer_criteria)
# Build the request
request <- traffic.estimator.request(cer)
# Download data from the API
r <- get.service(request = request,
cid = customer_id,
auth = google_auth,
api.version = api_version,
user.agent = "r-adwordsplus-test",
verbose = TRUE)
您可以使用 rgoogleads 包。
文档:https://selesnow.github.io/rgoogleads/docs/
参见关键字规划数据部分:https://selesnow.github.io/rgoogleads/docs/reference/index.html#section-keywords-planing-data
所以我需要通过 Google Adwords 获取某些关键字的流量估算。我看到 Google 有一个流量估算服务 API: https://developers.google.com/adwords/api/docs/guides/traffic-estimator-service .
我正在使用 R,它有一个非常全面的 RAdwords 包,https://jburkhardt.github.io/RAdwords/faq/,但是我很遗憾地没有找到它提供对这个特定 Adwords API 服务的访问的天气。
那么有人使用 R 通过流量估算器从 Google adwords 获取关键字数据吗?是否可以使用 RAdwords packege 或是否需要通过经典脚本来完成?
提前致谢。
有一个名为 RAdwordsPlus 的 R 包,它建立在 RAdwords 之上,可以做到这一点。
devtools::install_github("adviso/RAdwordsPlus")
library(RAdwordsPlus)
google_auth <- doAuth() # requires user interaction the first time
api_version <- "v201809"
customer_id <- "xxx-xxx-xxxx"
# Build keyword request
k <- keyword(
text = c("mars cruise", "cheap cruise", "cruise"),
match.type = c("BROAD", "PHRASE", "EXACT"),
type = "Keyword"
)
# Keyword estimate request
ker <- keyword.estimate.request(
keyword = k,
max.cpc = 5000000, # 1 million == one unit (microamaounts)
is.negative = FALSE
)
# AdGroupEstimateRequest
aer <- adgroup.estimate.request(ker)
# Criteria for CampaignEstimateRequest
cer_criteria <- vector("list", length = 2)
cer_criteria[[1]] <- as.criterion(id = "2826", type = "Location") # united kingdom
cer_criteria[[2]] <- as.criterion(id = "1000", type = "Language") # english
# CampaignEstimateRequest
cer <- campaign.estimate.request(aer, campaign.id = NULL, criteria = cer_criteria)
# Build the request
request <- traffic.estimator.request(cer)
# Download data from the API
r <- get.service(request = request,
cid = customer_id,
auth = google_auth,
api.version = api_version,
user.agent = "r-adwordsplus-test",
verbose = TRUE)
您可以使用 rgoogleads 包。
文档:https://selesnow.github.io/rgoogleads/docs/
参见关键字规划数据部分:https://selesnow.github.io/rgoogleads/docs/reference/index.html#section-keywords-planing-data