google-analyticsgoogle-analytics-4

How to get Entrances and Exits metric in GA4 API


In GA4 there are two metrics called Entrances and Exits, that shows the number of times the first event in a session happened on a page or screen.

The problem is that when searching in the API Dimensions and Metrics list, I couldn't find anything related, apparently those metric are for some reason not existent in the API.

I found out this reply that shows a way to find Entrances, but I couldn't find anything to get the Exits metric.

Does someone know how to get Exits metric from the API? Possibly also Entrances in an easier way,

thanks


Solution

  • There is no official "Exits" metric in GA4 API, so a workaround is to base on "last page" in a session in BigQuery Export (find the last page_view event for each session).