jburkhardt / RAdwords

Loading Google Adwords Data into R
https://github.com/banboo-data/r4googleads
Other
99 stars 36 forks source link

Bing support #73

Closed ysgit closed 6 years ago

ysgit commented 7 years ago

Hi @jburkhardt have you had any success in creating something similar to RAdwords for bing ads?

jburkhardt commented 7 years ago

Hi @ysgit @mbannert and me started a project from scratch with the aim to connect R and the Bing Ads API a long time ago. However, we never proceeded any further than the authentication process with the API.

You can find the code in a separate branch of the RAdwords repo: https://github.com/jburkhardt/RAdwords/tree/bing

Due to limited time and unpleasant XML overhead related with the Bing Ads API, we did not proceed with the project. You are welcome to pick it up again!

Microsoft provides client libraries in Python, Java and PHP for the Bing Ads API. It was convincing to use one of these libraries in order to retrieve Bing Ads data.

mbannert commented 7 years ago

Hi @ysgit.You unfortunately @jburkhardt is right. We do not have any plans currently to fight through the MS documentation, XML and all the things that are so much more fun /w Google stuff. The only chance I'd see for a quick R based fix would be a Python or Java wrapper. In any case I'd see a Bing solution in another package bingR.

djuery commented 7 years ago

Just to add something to this thread... In our tech team, we always use R to develop scripts in order to automate manual actions. We personally call the Bing Ads Python libraries via R, using the shell command. It is very adaptive, and though not being scripted fully in R, quite flexible. Happy to discuss this further if need be.

deepeshgoeliitk commented 6 years ago

You can use the package bingsAdsR from github.

Here is the sample code.

rm(list=ls())
# library(devtools)
# install_github("deepeshgoeliitk/bingAdsR")
library(bingAdsR)

##Variables##
credentials <- list(
  ###For authorization and access token###
  client_id = "XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
  client_secret = "XXXXXXXXXXXXXXX",
  ###To get data###
  username = "abc@abc.com",
  password = "***********",
  developer_token = "XXXXXXXXXXXXXXXXX",
  customer_id = "XXXXXXXXXX",
  account_id = "XXXXXXX"
)

####AUTHENTICATION#####
credentials <- baAuthentication(credentials)

#####Generate the data
startDate <- "2018-05-17"
endDate <- "2018-05-17"

report <- "CampaignPerformanceReport"
columns <- c("AccountName", "CampaignName", "TimePeriod", "Impressions", "Clicks", "Spend", "Conversions")

reportId <- getReportId(credentials, report, columns, startDate, endDate)
downloadUrl <- getDownloadUrl(credentials, reportId)
df <- getDataFromURL(downloadUrl)
mbannert commented 6 years ago

Btw... there's a new interface from R to Python. It's called reticulate and maintained by the folks at rstudio: https://github.com/rstudio/reticulate