Skip to content
Advertisement

How to get all properties for Google Analytics GA4 accounts

How do I list all properties for all account using Google Analytics GA4 through PHP? For universal analyitcs I’m using the following:

JavaScript

However, this method only allows me to retrieve Universal analytics properties, not the new GA4 ones. The official documentation was of no help at all.

Advertisement

Answer

Google analytics GA4 is not the same as universal analytics.

You can use the managment api to list all of the properties for Univeral analytics acocunts.

JavaScript

You will need to use the Admin api to list the Ga4 accounts.

JavaScript

At the time of writing they have not released a PHP client library for the Admin api yet. I will update with a link to it when it is released.

[update] The client libraries are available now at https://developers.google.com/analytics/devguides/config/admin/v1/client-libraries#php

User contributions licensed under: CC BY-SA
5 People found this is helpful
Advertisement