Learn business growth with Google Analytics 4 Forums Google Analytics 4 How to connect to the Google Analytics 4 API using PHP Reply To: How to connect to the Google Analytics 4 API using PHP

  • Anthony

    Member
    24 March 2023 at 1:05 pm

    The error message you’re seeing indicates that the service account with which you’re trying to access Google Analytics does not have the necessary permissions. Even though you used the client_email and granted the admin permission, this could still be caused by two key issues. Firstly, the service account email which you’ve set up in Google Cloud Platform might not have been added to Google Analytics. Make sure you’ve added it with ‘Read & Analyze’ permissions in the Google Analytics account. Secondly, the “VIEW_ID” you’re using in your PHP code may not be valid or may not belong to the account you’ve given permission to. Make sure that the view account’s ID is correct and is the one you’ve granted access to for the service account.