ARTICLE
Notes

Why does GA4 return 403, and what separates disabled from denied?

17 August 2026Majed Alandajani

I connected the Google account, set the GA4 property id, and opened the screen. Empty.

No error, no message, nothing. Just zeros everywhere.

Why an empty screen is the worst error message

Zero can mean three completely different things:

1. the number you entered is wrong 2. the number is right but the Analytics Data API is disabled on the Google Cloud project 3. the number is right and the API is on, but the linked account has no access to that property

Each one gets fixed somewhere else: the first in the input field, the second in Google Cloud, the third in GA4 property access.

The trap

Cases two and three both return 403. Exactly the same code.

Classify by status code alone and you tell the user "you lack permission" while the real problem is a disabled API. They head off to search in the wrong place.

The fix: read the message, not the code

Google states the difference in the response body:


const msg = String(j?.error?.message || `HTTP ${r.status}`);

if (/has not been used in project|is disabled|SERVICE_DISABLED/i.test(msg)) return "disabled";
if (r.status === 404 || /not found|does not exist/i.test(msg))            return "notfound";
if (r.status === 403 || /permission|PERMISSION_DENIED/i.test(msg))        return "forbidden";

Order matters: check "disabled" before "forbidden". The disabled message arrives wrapped in a 403, so testing the code first swallows it.

What I built on top

Saving the property id now triggers an immediate check, and the verdict comes back as a sentence that says where to fix things:

  • the id is valid and Google answers it
  • the id is accepted but the API is disabled on the Cloud project
  • the account has no access to this property
  • no property carries this number

A lesson wider than GA4

A status code is a coarse classification. Any API that returns 403 for two different situations forces you to read the body. Show the user an empty screen instead and a two-minute problem grows into an hour of searching.

Related reading

Have a project in mind?
Tell me what you want to build. Your first 15 minutes of consulting are free.
Book a consultation