skip to Main Content

Php versions – How use Google Analytics Reporting api with new GA4 accounts

Before GA4 i use a custom php dashboard with dimensions and metrics for reporting stats. I use VIEW_ID for having my stats. Here my code : function initializeAnalytics(){ $KEY_FILE_LOCATION = '/google-api-php-client/service-account-credentials.json'; $client = new Google_Client(); $client->setApplicationName("Reporting"); $client->setAuthConfig($KEY_FILE_LOCATION); $client->setScopes(['https://www.googleapis.com/auth/analytics.readonly']); $analytics =…

VIEW QUESTION
Back To Top
Search