Back in the old days of universal analytics, there was a report that not that many users knew about or used, but could hold some interesting insights, i.e. the “Frequency & Recency” report which is absent from google analytics 4.
This report used to show the “Count of Sessions” dimension , i.e. “buckets” of the nth number of session of a unique user. What I liked about this report is that it would give you a view on engagement and stickiness that other metrics didn’t show, what I didn’t like about it is that it showed this dimension with a metrics of sessions, instead of users which would have been more accurate and helpful.
As of now, this dimension is not supported in GA4 and I wouldn’t hold my breath waiting for Google to add it, so it’s up to us to recreate it. Since there is no way to build it in the GA4 interface itself, you’ll need to use BigQuery and run the following query:
SELECT user_pseudo_id, COUNTIF(event_name = "session_start") as num_of_sessions FROM 'myproject.analytics_343884170.events_*' //change to your project and table id where _table_suffix between '20230805' and '20230805' //change to the date frame you want group by 1,2 order by num_of_sessions desc
The output of this query will look like this:
Now, you can improve the query and create a more elaborate table (for example use a dynamic date range or adding the event_date etc.), but in this case I choose to keep it simple and to the point, since this gives you the raw data you need in order to recreate the count of sessions report and we only need to style it via Looker Studio.
First you need to connect the data to Looker Studio. There are 2 ways you can do this:
1) Custom Query – In Looker Studio you can add a data source which is built on a custom query, simply add a new data source, choose BigQuery and there in the left side menu you will see the option of “Custom Query”, here in the query window you’ll need to paste the query from above (don’t forget to modify to your needs and change to your specific project)
2) Table in BigQuery – You can also create a table in BigQuery to hold this data and that will refresh daily. After you run your query, above the results pane you will see a button for “Save Results” which will open a drop down menu, there choose the option of “BigQuery Table”. this will open a setting panel for your saved table.
After this is done you’ll need to create a daily scheduled update for this new table, in order to get the updated data each day. Once this is done, you can pull this into Looker Studio via the same BigQuery connector only choose “My Projects” and your specific table.
No matter which method you used to get the data in Looker Studio, now you will need to create a table with “num_of_sessions” as dimension (yes, a dimension), and number the metrics is the count of pseudo_user_id. You can also add a pie graph if you want a visualization of the % breakdown per number of sessions.
Now, if you want to go the extra mile I would suggest changing the values to something more litteral in order to avoid confusion by the reader. You can either adjust the original query or manipulate the data in Looker Studio, in any case I would use a simple format. In Looker Studio create a new field with this formula:
concat(num_of_sessions, ' Sessions')
In BigQuery adust the “num_of_sessions” line in the query as so:
concat(COUNTIF(event_name = "session_start"),' Sessions') as num_of_sessions
This will change the output from number of “2”, “3” etc. to “2 Sessions”, “3 Sessions” etc. And that’s it, you now have reconstructed the count of sessions report in google analytics 4.
Leave a Reply