Learn business growth with Google Analytics 4 Forums Google Analytics 4 Access Denied: Reporting Issues with Google Analytics 4

  • Access Denied: Reporting Issues with Google Analytics 4

    Posted by Amelia on 12 November 2022 at 12:24 pm

    I’ve got this PHP service that’s crunching data from all sorts of places – UA, GA4, you name it. It’s picking up what it needs through the Analytics PHP client and gets all official-like by loading up a JSON credentials file. These are the same credentials that I’ve been using to run successful reports on properties I threw together manually. Heck, they’re the same ones I used in a script to create most of the GA4 properties I’ve got and their associated data streams. This service account is no slouch, it has admin rights both on accounts and property levels for all properties.

    But here’s where things get annoying. When I try to run reports, the API slaps me with an error on every darn GA4 property, apart from the ones I made manually months ago. Here’s the nasty message it gives me:

    {
        "message": "User does not have sufficient permissions for this property. To learn more about Property ID, see https://developers.google.com/analytics/devguides/reporting/data/v1/property-id.",
        "code": 7,
        "status": "PERMISSION_DENIED",
        "details": []
    } {"userId":XXXXXXXX,"exception":"[object] (Google\ApiCore\ApiException(code: 7): {
        "message": "User does not have sufficient permissions for this property. To learn more about Property ID, see https:\/\/developers.google.com\/analytics\/devguides\/reporting\/data\/v1\/property-id.",
        "code": 7,
        "status": "PERMISSION_DENIED",
        "details": []
    }
    

    For the life of me, I can’t figure out why the API is okay with the manually created properties but chokes up and throws a fit about permissions when I try to run reports on properties that I created with the exact same account and credentials.

    I’ve tried a couple things out:

    – Making a GA4 property by hand
    – Fabricating a GA4 property using my script
    – Fiddling around with the service account’s rights and permissions

    And I’ve checked the following:

    – The credentials file (looked okay to me)
    – The request my client is sending (property parameter format seems alright)
    – The permissions and role of the service account I’m using (nothing suspicious)

    So yeah, I’m scratching my head over this one. Any thoughts?

    Grayson replied 1 year, 4 months ago 3 Members · 2 Replies
  • 2 Replies
  • Skyler

    Member
    4 February 2023 at 10:06 am

    It sounds like Google’s API is not giving the right permissions to properties created through your script. You might be facing a permissions propagation delay, or maybe there’s a bug with the property creation script. A good approach could be comparing detailed settings of a manually created working property and a script-created property, to see if anything comes up differently.

  • Grayson

    Member
    5 February 2023 at 6:23 am

    This sounds like a challenging, yet interesting problem. It appears that you have a well-functioning PHP service that utilizes the Google Analytics API. This service uses the same account and set of credentials to successfully run reports on manually created properties but hits a ‘PERMISSION_DENIED’ roadblock when it comes to properties that were machine-generated. Despite the account possessing admin access on all accounts and properties, the service-specifically denies permission for these properties. You’ve attempted troubleshooting by creating a GA4 property both manually and via script, and by playing around with the rights and permissions of the service account-all to no avail. Understandably, this boggles you, as the service seems to be able to manipulate data using the same credentials, yet fails to run reports. You’ve also confirmed that the credentials file, client request format, and service account permissions are all kosher. This surely is a perplexing situation.

Log in to reply.