I’m working on a solution that will be able to generate one funnel and its steps automatically based on certain criteria. This would be done through the GA4 API on GCP and have the data returned to be rendered on a custom frontend web application.
Some context before going into specifics;
-
We’ll be querying various GA4 properties that we don’t own
-
We have a service account that can query client properties using their id
-
It’s safe to assume there will be algorithms to accomplish things that I don’t go into detail for
-
We’re currently using the BetaAnalyticsDataClient from @google-analytics/data on GCP
-
The starting and ending steps of this funnel can be provided
-
Analytics reports from the web UI will be used for illustrative purposes only
-
Limiting factor: amount of manual setup clients would have to go through
-
Limiting factor: overkill on permissions requirements (ex. using the GA4 admin API)
-
As a last resort, Google Tag Manager, BigQuery, and other technology are not out of the question
The following picture describes the general logic using the publicly accessible Google Merch Store data:
GA4 Path exploration with highlighted successful paths
Highlighted in green are two candidates for a “successful path” that would be compared.
The path with the most users would be used as the steps to generate the funnel report.
The idea we currently have is to use the data from the GA4 API to build journeys from for example, Home to an add_to_cart event. Afterwards, these journeys would be grouped by similar steps taken and then the group with the most traffic would be selected for a funnel report.
Implementation plans that were looked into and their associated roadblocks:
-
Path exploration; build the path by navigating through nodes, and then generate a single funnel report
- Has no equivalent in the API at the time of posting
-
Simulating path exploration by manually building paths via custom reporting:
-
Custom runReport with segments to filter users that went the path of A>B>C and picking the best path
- No programmatic way to create segments using the API at the time of posting
-
Custom runReport to build A>B>C manually to do the above
- Couldn’t find metrics/dimensions that allow us to identify + build an individual journey
- Requirements would be something to differentiate sessions and a timestamp to order the results
- Timestamps are only down to the minute, which aren’t precise enough to build an ordered user journey
-
-
Export to BigQuery
-
BigQuery has access to session id and timestamps, which would let us do the above
-
Since we’re working with multiple clients where we do not own their GA4 properties, this seems cumbersome.
-
Thanks for taking the time to read through all of this!
KCnpnd is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.