首页 > 解决方案 > 在 RStudio 中编织 GA 数据:相同(body,FALSE)中的错误:找不到对象“redirect.uri”

问题描述

我正在使用该rga软件包来跟踪我的 Google Analytics(分析)数据。

当我在 R 中创建脚本时,我成功地从 GA 检索数据:

library(rga)
library(curl)

rga.open(instance="ga")

x <- ga$getProfiles()
id <- x[3,1] # here we select the ID of the webpage we are tracking

visits <- ga$getData(id, 
                      start.date= as.Date("2016-01-01"), 
                      end.date = "today", 
                      metrics = "ga:visits, ga:pageviews, ga:organicSearches",
                      dimensions = "ga:date", 
                      sort = "", filters = "", segment = "",
                      start = 1, max = 1000,
                      batch = TRUE)

但是,当我将此代码复制/粘贴到 RMarkdown 文件中的一个块中时,在将其转换为 HTML/PDF/Word 时出现此错误:

相同(正文,FALSE)中的错误:找不到对象'redirect.uri'调用:...-> request_build-> body_config-> 相同执行暂停

如何使用 R Markdown 创建关于我的 GA 数据的报告?我怎么解决这个问题

标签: rgoogle-analyticsr-markdownknitr

解决方案


推荐阅读