Marketing data · 15 min · reviewed 2026-09-06

How do I connect Google Analytics (GA4) to a CRM with an OAuth key?

Create an OAuth client in Google Cloud, enable the Analytics Data API, get a refresh token for a Google account that can view the property, and paste a small JSON bundle (client id, client secret, refresh token, GA4 property id) into Settings → Other keys → Analytics. One bundle also serves Search Console.

What you will need

  • A Google Cloud project you own (https://console.cloud.google.com).
  • A Google account with at least Viewer on the GA4 property.
  • The GA4 property id: Admin → Property settings. It is a number such as 123456789.

Steps

  1. 1

    Step 1

    In Google Cloud, APIs & Services → Library. Enable Google Analytics Data API and Google Search Console API.

  2. 2

    Step 2

    APIs & Services → OAuth consent screen: user type External, app name SalesCrew, add your own e-mail as a test user. Save.

  3. 3

    Step 3

    Credentials → Create credentials → OAuth client ID, type Web application. Add https://developers.google.com/oauthplayground as an authorized redirect URI. Copy the client id and client secret.

  4. 4

    Step 4

    Open https://developers.google.com/oauthplayground. Click the gear, tick Use your own OAuth credentials, paste the id and secret.

  5. 5

    Step 5

    In the scope box enter https://www.googleapis.com/auth/analytics.readonly https://www.googleapis.com/auth/webmasters.readonly and click Authorize APIs. Sign in with the account that can view the property.

  6. 6

    Step 6

    Click Exchange authorization code for tokens. Copy the refresh token.

  7. 7

    Step 7

    Build the bundle: {"client_id": "…apps.googleusercontent.com", "client_secret": "…", "refresh_token": "1//…", "ga4_property_id": "123456789"}

  8. 8

    Step 8

    In SalesCrew: Settings → Other keys → Analytics (GA4) → Set key. Paste the bundle. Save.

Common errors

403 on Test
the account has no access to that property, or the property id is the *measurement id* (G-…) instead of the numeric property id.
invalid_grant
the refresh token expired. Consent-screen apps in *Testing* expire tokens after 7 days; publish the app (Publishing status → In production) and repeat steps 4–6.
API not enabled
step 1 was skipped for one of the two APIs.

How you know it worked

Test connection reports ok with a sessions count. The Marketing page fills within the hour (the pull runs at :07).

Where this goes in SalesCrew

Settings → Other keys → Analytics (GA4) → Test connection. In your own workspace the same how-to opens beside the field, with your callback URLs filled in.