SCALIX help

← All tools

ga4_get_tracking_setup

Google Analytics 4 read low risk

Part of the Tracking Audit Agent.

What it does

Read a GA4 property's tracking setup and judge it as tracking-audit checks. Analytics Admin API v1beta, under the first connected Google login that can see the property: web data streams (stream id, name, measurement id G-..., default URL; app streams are left out), Google Ads links (customer id, ads personalization, whether it is a manager link) and key events (name, counting method, custom or default). Analytics Data API: daily keyEvents per key event for the 30 days ending yesterday, and the top 10 hostnames by sessions over the same days (where GA4 actually collects data). Checks: no web data stream, or no Google Ads link, is a problem; links only to accounts other than customer_id are suspected (fine when one is that account's manager or conversion account); links GA4 refuses to list to the connected login are not_verified while the rest is still read; no custom key event (none, or only defaults such as purchase) is suspected, since lead conversions are then not counted in GA4; a custom key event with 0 in 30 days is a problem, while default ones such as purchase are listed but never judged, and a custom one marked under 7 days ago, or at 0 in a report GA4 thresholded, is not_verified; two key events with the same daily counts (within 1) on at least 80% of the days with data are suspected double counting. Hostnames are data, not judged. If a Data API report fails, the Admin results still come back, with a not_verified check naming the report and Google's message. Read-only. Returns {property_id, streams:[{stream_id, display_name, measurement_id, default_uri}], google_ads_links:[{customer_id, ads_personalization_enabled, can_manage_clients}], key_events:[{event_name, counting_method, custom, count_30d}], hostnames:[{host, sessions}], checks:[{item, status, found, expected?, evidence?, fix?, owner?, priority?}], check_counts}; status is pass, problem, suspected, not_verified or info; count_30d and hostnames are null when their report could not be read, and google_ads_links when GA4 refused to list them.

When to use it

Use in a tracking audit for the GA4 side: which web streams and measurement ids collect, whether GA4 is linked to the Google Ads account, whether its custom key events fire, key events that count one action twice, and the hostnames GA4 collects on. Find the property id first with ga4_list_accounts_properties.

Inputs

NameTypeRequiredDescription
property_idstringyesGA4 property number (e.g. 123456789) or properties/123456789. From ga4_list_accounts_properties.
customer_idstringnoThe audited Google Ads account, 10 digits (dashes allowed). When given, a GA4 property linked only to other accounts is reported as suspected. Omit to skip that check.

Safeguards

Policy

GA4 is a separate Google product and scope from Google Ads: read only properties the connected Google account may see (analytics.readonly), never another tenant's, and never merge GA4 counts with Google Ads figures without labeling each. Read-only: it changes nothing in GA4 or Google Ads. No personal data: the email of whoever created a Google Ads link is never returned.

Reminder

Quote each check's status as returned: suspected is a pattern, not a proof, and not_verified says why it could not be seen; never present either as a problem. Key events are GA4's own conversions, not Google Ads conversion actions.

Errors

Error classMeansWhat to doRetry
invalid_argumentproperty_id is not a GA4 property number, or customer_id is not a 10-digit Google Ads id.Find the property with ga4_list_accounts_properties; pass the Google Ads id as Google Ads shows it, or leave it out.no
not_foundNo such GA4 property.Find the id with ga4_list_accounts_properties.no
permission_deniedNo connected Google login has access to that property.Ask the property's admin to add the Google account connected in Scalix as Viewer (GA4 Admin -> Property access management).no
platform_unavailableThe Google Analytics Admin API is not switched on for Scalix yet.Tell the user it is on Scalix's side, not their account; until it is fixed, read GA4 with the ga4_run_* tools and the property id.no
needs_reauthThe Google connection's token is dead, or it was made before Scalix asked for Google Analytics.Reconnect Google in the Scalix dashboard and accept the Google Analytics permission.no
connection_not_foundGoogle is not connected for this Scalix account.Connect Google in the Scalix dashboard.no
rate_limitedGoogle Analytics rate limit hit.Wait a minute, then call again.yes
ga4_errorGoogle Analytics did not answer or failed on its side.Retry shortly; if it keeps failing, tell the user Google Analytics is down.yes

Edge cases

  • A failing Data API report (quota, outage) does not fail the tool: the Admin results come back, count_30d or hostnames are null, and a not_verified check names the report and Google's message.
  • No key events, or only default ones such as purchase: a suspected Key events check says lead conversions are not counted in GA4 (with none, the daily report is skipped).
  • Default key events such as purchase are listed with their counts but never judged on 0.
  • A custom key event at 0 that was marked less than 7 days ago, or in a report GA4 thresholded (small numbers withheld), is not_verified, not a problem.
  • App data streams are left out, so a property with only app streams has no web data stream.
  • A link to the account's manager (can_manage_clients true) or to its conversion account is fine; the check says suspected because the tool cannot see the Google Ads hierarchy.
  • The 30-day window ends yesterday in the property's time zone; counts are GA4's own, not Google Ads conversions.