Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Realtime metrics/dimensions can not be ordered by in DSL - Error in is.OrderBy(x[[1]]) : object 'minutesAgo' not found #400

Open
MarkEdmondson1234 opened this issue Jun 7, 2022 · 1 comment
Assignees
Labels

Comments

@MarkEdmondson1234
Copy link
Collaborator

MarkEdmondson1234 commented Jun 7, 2022

The real-time metrics/dimensions listed here: https://developers.google.com/analytics/devguides/reporting/data/v1/realtime-api-schema

...are not in the dimension/metric list fetched via ga_meta("data") and so DSL calls fail.

ga_data_order(-minutesAgo)
#Error in is.OrderBy(x[[1]]) : object 'minutesAgo' not found

Workaround - call functions the DSL uses yourself:

ga_data_order(googleAnalyticsR:::OrderBy(dimension = googleAnalyticsR:::DimensionOrderBy("minutesAgo")))
#==GA4 OrderBy==
#Dimension:     MinutesAgo 
#OrderType:     ALPHANUMERIC 
#Descending:    TRUE 

e.g.

mins <- ga_data_order(googleAnalyticsR:::OrderBy(dimension = googleAnalyticsR:::DimensionOrderBy("minutesAgo"),
                                                       desc = FALSE))

ga_data(prop_id,
              metrics = "activeUsers",
              dimensions = c("minutesAgo", "audienceName", "user_profession"),
              orderBys = mins,
              realtime = TRUE)
@MarkEdmondson1234
Copy link
Collaborator Author

the limit = -1 doesn't work either with real-time fetches

! http_400 limit must be positive. The API received limit = -1

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

No branches or pull requests

2 participants