I am using Python API to retrieve information to generate analytics report for an app. We are using the new GA4.
Sending the event parameter : Event Category, Event Action, Event Label and Event Value
through the gtag.js while triggering the event.
The parameters are labelled as follows: Category, Action, Label, Value
Now, once the events are triggered, I need to collect all the information about the events from GA4 and make a my own report using Python API calls. I need the information of all the Event Label and Event Value which was passed through gtag.js
I am using:
request = RunReportRequest(
property=f"properties/{property_id}",
dimensions=[Dimension(name="eventName")],
metrics=[Metric(name="eventCount")],
date_ranges=[DateRange(start_date= sdate, end_date= edate)],
)
client = BetaAnalyticsDataClient()
response = client.run_report(request)
This will just give the Event Name and the count of the events that occurred.
I read that in GA3, eventLabel, eventCategory and eventAction
are treated as dimensions and eventValue
as a metric. But seems like that's not the case in GA4.
I tried eventLabel
as the dimension in the dimension field in the request payload. It threw me error saying its not a valid dimension.
I tried eventValue
in metrics field and that would provide me the summation of all the Event Value for each event.
But I need the individual Values of each Event and also the Label corresponding to it. Is there any way that I can retrieve this information? Am I missing anything? Happy to share more info if required.
Any help is appreciated. Thanks in advance :)