我在R中的代码有问题。我正在尝试使用google_analytics_3函数从Google Analytics(分析)下载数据。我的代码一直有效到上周,但现在不起作用。
我显示我的代码:
library(googleAnalyticsR)
library(googleAuthR)
options(httr_oauth_cache=FALSE,googleAuthR.scopes.selected = "https://www.googleapis.com/auth/analytics.readonly")
gar_auth(email = myemail,cache = getOption("httr_oauth_cache"),scopes = getOption("googleAuthR.scopes.selected"))
dataAnalytics <- google_analytics_3(id = id,start = '2018-01-01',end = Sys.Date()-1,metrics = c('transactions'),dimensions = 'date',filters = paste0('ga:city==','madrid'),max_results = 10000)
尝试此操作时,出现以下错误:
Request Status Code: 404
Error : lexical error: invalid char in json text.
<!DOCTYPE html> <html lang=en>
(right here) ------^
<!DOCTYPE html>
<html lang=en>
<meta charset=utf-8>
<meta name=viewport content="initial-scale=1,minimum-scale=1,width=device-width">
<title>Error 404 (Not Found)!!1</title>
<a href=//www.google.com/><span id=logo aria-label=Google></span></a>
<p><b>404.</b> <ins>That’s an error.</ins>
<p>The requested URL <code>/analytics/v3/data/ga/</code> was not found on this server. <ins>That’s all we know.</ins>
Error: lexical error: invalid char in json text.
<!DOCTYPE html> <html lang=en>
(right here) ------^
我不知道发生了什么。你能帮我吗?
谢谢!