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
Segments doesn't work for GA4 #382
Comments
Yes segments don't exist for GA4, they are a session based concept which doesn't fit the new event data model. Use filters instead. |
Hi @MarkEdmondson1234 – I understand the difference between sessions and events, but you can still create segments at the session-level in the GA4 UI. I understand filtering can be done but we can't reach the same level of data that way. Is this a GA4 API restriction or a decision for the project? |
2 years ago there weren't segments in the API, but now they are in there as Audiences and funnels. However I'm committed to other projects so not looking at this myself for the foreseeable future but welcome any pull requests. |
Hello Mark, I greatly appreciate your contribution to the development of the GA API for R. Your package is my top weapon in my arsenal. I would like to promote this project, but I have limited experience in developing R packages. Could you please guide me on which raw file to access in order to integrate audiences and funnels into this package? |
I suggest initially get the API calls to work via In the APIs alpha channel are the new endpoints:
As its alpha, set the API version at the top of the version_aw <- function(){
"v1alpha" # chage in your local version
} Once you have it working with Then the output of that function (which should be I guess an R list that will be turned into JSON in the request) should be invoked by a parameter in the original brrr <- RunReportRequest(
metrics = mets,
dimensions = dims,
dateRanges = dates,
limit = limit,
dimensionFilter = dimensionFilter,
metricFilter = metricFilter,
metricAggregations = metricAggregations,
orderBys = orderBys,
keepEmptyRows = TRUE,
returnPropertyQuota = TRUE,
# add new JSON objects here
)
ga_aw_report(propertyId, brrr, page_size) |
Thanks Mark, I think I can get it by the end of this year. :) |
Hello, Mark and 8 bit sheep , I am aware that this project has been transferred but is there any way segments can be brough to the R package please? I did some digging around but its too above my current level of expertise to understand any of these things and i have repeatedly requested google devs for support but there has been no response from them to add segments to runreport method in data api. The segments are available in the alpha funnel report : https://developers.google.com/analytics/devguides/reporting/data/v1/rest/v1alpha/properties/runFunnelReport#segment Waiting for this feature to be added as its impossible to create AB test reports without segments and automate them. |
I can't make segments work for GA4, I use the code below from another comment and it says
"Error in ga_data(my_property_id, date_range = c("2020-07-23", Sys.Date() - :
unused argument (segments = seg)"
When I change it to google_analytics it returns an error stating user doesn't have permission. Having looked at the documentation for the GA API segements doesn't seem to be supported, so did this ever work? Could someone share a working example if so?
thanks,
Ben
The text was updated successfully, but these errors were encountered: