Marketing data · 10 min · reviewed 2026-09-06
How do I connect PostHog and Google Tag Manager to a CRM?
PostHog needs a personal API key and the project id; the CRM pulls sessions hourly and can trace a lead back to the pages they visited. Google Tag Manager is optional: it uses the same OAuth bundle as Analytics and only reads container versions for the audit trail.
What you will need
- Admin on the PostHog project (https://us.posthog.com).
- For GTM: the OAuth bundle from the Google Analytics how-to with the scope https://www.googleapis.com/auth/tagmanager.readonly.
Steps
- 1
Step 1
PostHog: Settings → Personal API keys → Create. Scope Read on the project. Copy the key.
- 2
Step 2
Note the project id from the address bar (/project/12345/).
- 3
Step 3
In SalesCrew: Settings → Other keys → Product analytics (PostHog) → Set key. Paste {"api_key": "phx_…", "project_id": "12345"}. Save. Test.
- 4
Step 4
GTM (optional): Settings → Other keys → Google Tag Manager → Set key, paste the Analytics bundle with "container_id": "GTM-XXXX" added.
Common errors
- 401 from PostHog
- the key is a *project* API key (phc_…), which is public. Create a *personal* key.
- No sessions
- the site does not load the PostHog snippet, or the project id is wrong.
How you know it worked
Test connection returns today's visitor count. Marketing → Sessions lists recent visits.
Where this goes in SalesCrew
Settings → Other keys → PostHog → Test connection. In your own workspace the same how-to opens beside the field, with your callback URLs filled in.