Skip to content
This repository has been archived by the owner on Mar 23, 2021. It is now read-only.

fetch.by with ga:users and ga:NdayUsers #15

Closed
m-stanley opened this issue Jan 26, 2016 · 5 comments
Closed

fetch.by with ga:users and ga:NdayUsers #15

m-stanley opened this issue Jan 26, 2016 · 5 comments

Comments

@m-stanley
Copy link

Sorry that this is more of a question than an issue.

When using the fetch.by parameter with the ga:users or ga:NdayUsers metrics, get_ga() sometimes returns a warning:

The 'ga:users' or 'ga:NdayUsers' total value for several days is not the sum of values for each single day. 

I note that in date-ranges.R the function is just explicitly checking for those metrics to display the warning.

So my question is, is the warning displaying because when the query is split by the fetch.by parameter, the ga:users value will be higher than if the query was run without the fetch.by, because that value is actually the sum of several sub-query values?

It wasn't explicitly clear to me whether the warning was that the ga:users figure would be inaccurate, or if it was just a helpful reminder of how GA is calculating users.

@m-stanley
Copy link
Author

I should add that I was using ga:date as a dimension, and that's partly why the warning confused me - because running the query with fetch.by = "day" should only affect the sampling and not the results.

@artemklevtsov
Copy link
Owner

Please read the docs: https://support.google.com/analytics/answer/2992042.

To illustrate the problem try the following:

library(RGA)
authorize()
get_ga(id, "8daysAgo", "today", "ga:users")
#>   users
#> 1   748
get_ga(id, "8daysAgo", "today", "ga:users", fetch.by = "day")
#> 1   932
#> Warning: The 'ga:users' or 'ga:NdayUsers' total value for several days is not the sum of values for each single day.

@m-stanley
Copy link
Author

Thanks - I just wanted to be explicitly clear before I started using fetch.by exactly how it was working.

In your second get_ga(), internally RGA is substituting this with 9 individual queries, with the start.date and end.date set to one particular day in the sequence, then summing the results. Is that correct? So in the first query, an individual user can only appear once, but in the second, a user who came every single day would count as 9 users because of the addition. That's the cause of the larger result for ga:users in the example using fetch.by.

@artemklevtsov
Copy link
Owner

You're right. But I don't know how to fix it for this metric. With other metrics the fetch.by works correct.

@m-stanley
Copy link
Author

I don't think there is a way to fix it, so it's right that fetch.by raises a warning. It might help if it was added to the last section of the reporting API vignette? That's where I looked first for clarification.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants