artemklevtsov / RGA

A Google Analytics API client for R
http://cran.r-project.org/package=RGA
32 stars 13 forks source link

Result sample data #38

Closed meidata closed 8 years ago

meidata commented 8 years ago

Hi Artem,

I am using the RGA to perform analysis in R, My google analytic account is google analytics Premium, And I am running this script following to get the the data, but it showed

Data contains sampled data. Used 4889766 sessions (46% of sessions).

I have already set the samplingLevel and fetch.by parameters in the get_ga()

ga_data <- get_ga(id, start.date = "2016-06-10", end.date = "today",
                metrics = "ga:Pageviews",
                dimensions = "ga:dimension8,ga:pagePath",
                samplingLevel="HIGHER_PRECISION",fetch.by = "week",
                max.results=NULL)
Batch processing mode enabled.
Fetch data by week: from 2016-06-10 to 2016-07-11.
  |========================================================================| 100%
Warning message:
Data contains sampled data. Used 4889766 sessions (46% of sessions).

Do you know how can i get 100% sessions instead of 46%?

Thank you in advance!!

Meiyi

artemklevtsov commented 8 years ago

Try with fetch.by = "day".

meidata commented 8 years ago

It works, thank you very much!

meidata commented 8 years ago

Hi Artem,

When i changed to the day, it works, but when i ran the second time, it showed the following error,

Do you know why?

ga_data <- get_ga(id, start.date = "2016-06-11", end.date = "today",
               metrics = "ga:sessions",
               dimensions = "ga:dimension8, ga:pagePath",
               samplingLevel = "HIGHER_PRECISION",
                 fetch.by = "day",max.results=NULL)
Batch processing mode enabled.
Fetch data by day: from 2016-06-11 to 2016-07-11.
  |====================================================================| 100%
Error in vapply(x, function(x) as.numeric(x[[name]]), numeric(1)) : 
  values must be length 1,
 but FUN(X[[1]]) result is length 0

Thank you in advance,

Meiyi

artemklevtsov commented 8 years ago

Try the latest dev version from the git repo. This bug was fixed in ef53f0a9ae78b4b72207e932369ee0740b0538ef.

meidata commented 8 years ago

Thank you so much Artem,

Sorry but i have another question, i manully check the GA for a custom report, there is 5,414,236 rows but when i export it in R using the fetch.by, it only returned 2526 records, have you encountered this problem?