我使用RGoogleAnalytics檢索多維數據,但每次我嘗試運行ga.data <- ga$GetReportData(query)
然後我得到一個錯誤消息:fromJSON(api.response.json,method =「Error」 C「): 意外在pos 53 轉義字符‘\’」這沒關係,當我嘗試其他功能 我怎麼能解決這個 我使用下面的代碼:使用RGoogleAnalytics從谷歌檢索數據
require("RGoogleAnalytics")
query <- QueryBuilder()
access_token <- query$authorize()
ga <- RGoogleAnalytics()
ga.profiles <- ga$GetProfileData(access_token)
profile <- ga.profiles$id[3]
startdate <- "2013-10-01"
enddate <- "2013-12-31"
dimension <- "ga:date,ga:source,ga:medium,ga:keyword,ga:city,ga:operatingSystem,ga:landingPagePath"
metric <- "ga:visits,ga:goal1Completions,ga:goal3Completions"
sort <- "ga:visits"
maxresults <- 500000
query$Init(start.date = startdate,
end.date = enddate,
dimensions = dimension,
metrics = metric,
max.results = maxresults,
table.id = paste("ga:",profile,sep="",collapse=","),
access_token=access_token)
ga.data <- ga$GetReportData(query)
您應該發佈更完整的代碼,從所有需要的庫調用開始,包括用於查詢的代碼。 –
感謝您的提醒 – Garftalk