This function starts the authentication process with Microsoft Bing. One would need to set up a developer account to use the api. Follow the process here: https://docs.microsoft.com/en-us/bingads/guides/customer-accounts?view=bingads-12#accountpermissions
https://developers.bingads.microsoft.com/Account
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 | ##Not run
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)
report <- "AccountPerformanceReport"
columns <- c("AccountName", "DeviceType", "TimePeriod", "Impressions", "Clicks", "Spend", "Conversions")
reportId <- getReportId(credentials, report, columns, startDate, endDate)
downloadUrl <- getDownloadUrl(credentials, reportId)
df <- getDataFromURL(downloadUrl)
##End(Not run)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.