从GA导入数据按名称中包含间隔的维度拆分

时间:2016-10-26 15:48:03

标签: r google-analytics

我使用RGA包将数据从GA导入到R.该包非常有用,但是当尝试导入由名称包含间隔的维分割的数据时,会返回以下错误消息:< / p>

  

错误:客户端错误:(400)错误请求错误请求:未知   dimension(s):ga:Week_of_Year

代码:

library(RGA)
authorize()
id <- "95872896"
Sessions.by.source <- get_ga(id, metrics = "ga:New Users",
                             dimensions =   c("ga:Date","ga:Source","ga:Week of Year"),
                             sort = "ga:Date")
  

sessionInfo():

R version 3.3.1 (2016-06-21)
Platform: x86_64-w64-mingw32/x64 (64-bit)
Running under: Windows >= 8 x64 (build 9200)

locale:
[1] LC_COLLATE=English_United Kingdom.1252  LC_CTYPE=English_United Kingdom.1252   
[3] LC_MONETARY=English_United Kingdom.1252 LC_NUMERIC=C                           
[5] LC_TIME=English_United Kingdom.1252    

attached base packages:
[1] grid      stats     graphics  grDevices utils     datasets  methods   base     

other attached packages:
 [1] RGA_0.4.2         zoo_1.7-13        tidyr_0.6.0       stringr_1.1.0     RODBC_1.3-14     
 [6] devtools_1.12.0   curl_1.2          RGA_0.4.2         httr_1.2.1        jsonlite_1.1     
[11] RCurl_1.95-4.8    bitops_1.0-6      taskscheduleR_1.0 gridExtra_2.2.1   dplyr_0.5.0      
[16] plyr_1.8.4        ggplot2_2.1.0     scales_0.4.0      data.table_1.9.6  r2excel_1.0.0    
[21] xlsx_0.5.7        xlsxjars_0.6.1    rJava_0.9-8      

loaded via a namespace (and not attached):
 [1] Rcpp_0.12.6      tools_3.3.1      digest_0.6.10    lubridate_1.5.6  memoise_1.0.0    tibble_1.1      
 [7] gtable_0.2.0     lattice_0.20-33  DBI_0.4-1        withr_1.0.2      R6_2.1.2         magrittr_1.5    
[13] assertthat_0.1   colorspace_1.2-6 httpuv_1.3.3     labeling_0.3     stringi_1.1.1    openssl_0.9.4   
[19] lazyeval_0.2.0   munsell_0.4.3    chron_2.3-47   

此致

1 个答案:

答案 0 :(得分:0)

API维度定义与GA本身的标签不同。 有关API维度的定义,请参阅:

https://developers.google.com/analytics/devguides/reporting/core/dimsmets