-
Access Denied: Reporting Issues with Google Analytics 4
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 permissionsAnd 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?
Log in to reply.