Browse docs
Sprid docs

Connect Google Analytics 4

See how many people visit your website, where they came from and which pages they land on. If your app uses Firebase Analytics, this is also how Sprid sees your app’s active and new users.

Before you start

Editor or Administrator on the GA4 property, and a Google service account. You can reuse the one from Sprid’s Google Play or Search Console connection.

Set it up

A. Google Cloud

  1. Open Google Cloud and select your service account’s project.
  2. APIs & Services → Library: enable Google Analytics Data API.
  3. No service account yet? IAM & Admin → Service Accounts → Create service account, name it sprid-analytics, then Done.
  4. Open the account → Keys → Add key → Create new key → JSON. Save it as ga4-sa.json and copy the account’s email. Reusing an account? Use its existing key file and email.

B. Google Analytics

  1. Open Google Analytics and select the property.
  2. Admin → Property access management → + → Add users.
  3. Enter the service account’s email, choose Viewer, uncheck the notification email, then Add.

C. The property id

  1. Admin → Property details. Copy Property ID: digits only, such as 493820184.

A measurement id (G-XXXXXXX) is the tag on your page, not the property. The Data API refuses it, so Sprid rejects it when you type it.

Connect to Sprid

Run in your terminal
sprid connect ga4 --key ~/Downloads/ga4-sa.json --property 493820184

Use your own file path and property id. Keep the file private.

Add --use to make Google Analytics the source Sprid reports website traffic from. See Only one provider answers below.

Check the connection

Run sprid status, then ask your agent: “Read this website’s visitors for the last 28 days through Sprid and say which provider answered.” A saved key confirms setup; only the live read confirms access.

Only one provider answers

PostHog, Google Analytics and Plausible all count the same visits to the same site. Sprid reads one of them per app and never adds them together, because adding them would overstate your traffic by roughly the overlap, and the overlap is nearly everything.

With one connected, that one answers. With several, Sprid uses the one you chose with --use (PostHog by default, because it also answers the people and registration cards). The others stay connected and idle, and the traffic card says so.

If something goes wrong
  • Permission denied: access is granted on the property, not on the Google Cloud project. Check the service account’s email is in Property access management with at least Viewer.
  • API not enabled: enable Google Analytics Data API in the project the key came from, then wait a minute.
  • Property not found: you probably saved a measurement id or a stream id. Use Admin → Property details → Property ID.
  • Numbers do not match the GA4 dashboard: Google applies thresholding and its own bot filtering, and reports in the property’s time zone rather than UTC. Small differences on small properties are expected.
What Sprid can and cannot read here

Visitors, pageviews, sessions, engaged sessions and engagement time, plus breakdowns by country, region, city, source, channel group, campaign, term, page, landing page, hostname, browser, operating system and device.

Two honest gaps. Google reports no exit page, so that breakdown is empty rather than estimated. And channel is Google’s own default channel group and referrer is the session source, neither of which is the raw referring domain another provider would show, so those rows do not compare like for like across providers.

Sources and verification

Prefer your terminal? sprid docs google-analytics reads this same guide.

Need a hand?
Colour theme
Back to Sprid ↗