8-bit-sheep / googleAnalyticsR

Use the Google Analytics API from R
https://8-bit-sheep.com/googleAnalyticsR/
Other
257 stars 76 forks source link

Can you add dataLossFromOtherRow from the GA4 API as a custom measurement or field? #427

Open mlane3 opened 1 year ago

mlane3 commented 1 year ago

Is your feature request related to a problem? Please describe.

Recently my organization has noticed several issues with the Node.js/JSON version of the google analytics API where the data is either sampled or *thresholded for report queries. There is a bug where it triggers for single-value total/subtotal queries of public library data--particularly data with no geography, age, or other demographic information. Now in the google analytics API, there are two "measurements" that instead of being in the body of the API response are in the response part.

After lengthy conversations, I discovered that should in theory be able to measure if this is happing thanks to the fields dataLossFromOtherRow and subjectToThresholding. However, I cannot figure out how to best add those fields to the query.

https://developers.google.com/analytics/devguides/reporting/data/v1/rest/v1beta/ResponseMetaData

Definition of Sampling: Sampling will occur based on what limit you set and """high cardinality""" https://support.google.com/analytics/answer/13331684?hl=en&ref_topic=13384306&sjid=11578364446800054975-NA# Definition of Thresholding: Thresholding is a limit on the API Google places to prevent you from identifying a natural person's identity. It's a requirement under GDPR.

Describe the solution you'd like To one of the commands or as a custom metric, could you add dataLossFromOtherRow so it can be made a column in the output of ga_data()? The ideal solution would be a way of having that as a single value column that one can grab from the data.

Describe alternatives you've considered There are none, which is why I am also reaching out to open a ticket with Google itself. The alternative plan is if you are unable to do so, then my boss will work on submitting an official request to Google.

gronerik commented 1 week ago

Hi @mlane3! Sorry for the delay on getting a response to you. Since some time has already passed, I'm just checking quickly first, if you still need this (after a year)? I think this is a great feature request and should be quite quick task to add support for it.

We don't have any plans for the next googleAnalyticsR release yet, but this should definitely be along once we'll get there.