googleapis / google-api-php-client

A PHP client library for accessing Google APIs
Apache License 2.0
9.22k stars 3.52k forks source link

Google Analytics 4 API #2477

Closed sajadsaadat closed 8 months ago

sajadsaadat commented 1 year ago

Hello I use this script to work with Google Analytics data. Considering that in version 4, we don't have view id anymore and instead it has property id, how can this script be used?

Does this script support Google Analytics version 4? I used property id instead of view id in the script several times but it didn't work.

dg-jj commented 9 months ago

I checked through the GA4 API and it said there is a view_id, but GA4 does not have a view. Where is the view_id?

vishwarajanand commented 8 months ago

@sajadsaadat I am unable to understand your requirement and where it falls short from the provided context. Some snippet will definitely help.

This link provides how to fetch a property id. Using property id and the Data API, you should be able to fetch the analytics. Quickstart sample