Why connect website analytics to CRM pipeline?
You connect website analytics to CRM pipeline so marketing can report revenue by source instead of visits by channel. GA4 knows where a visitor came from but not whether they became a customer. The CRM knows which deals closed but not how the buyer first arrived. Joining the two is what turns a traffic report into a revenue report.
Without the connection, every argument about budget runs on proxies. Paid social looks great on clicks, organic looks great on sessions, and nobody can say which one produced the deals that closed last quarter. With it, you can show which page created the most pipeline, or whether a channel with modest traffic produced the biggest deals.
This how-to is part of our hub on marketing website analytics. It covers the practical setup: UTM rules, a first-touch cookie, hidden fields and CRM properties, with notes for HubSpot and Salesforce.
What data should pass from the website to the CRM?
Pass the data that explains how a buyer arrived, at both the first and the converting visit: UTM parameters, the referrer, the landing page, the page where they converted, and a self-reported source. Store first-touch values once and never overwrite them; store last-touch values on every conversion.
Field | Captured when | Write rule | Example value |
|---|---|---|---|
First-touch source and medium | First visit | Write once | google / organic |
First-touch campaign | First visit with UTMs | Write once | q3-comparison-launch |
First landing page | First visit | Write once | /compare/vendor-a |
First referrer | First visit | Write once | chatgpt.com |
Last-touch source and medium | Each form fill | Overwrite | linkedin / paid-social |
Conversion page | Each form fill | Overwrite | /pricing |
Self-reported source | Each form fill | Keep raw text | Asked ChatGPT for options |
GA4 client ID | Each form fill | Overwrite | Value of the _ga cookie |
The referrer field matters more than it used to. Visits from ChatGPT, Perplexity and other AI tools often carry a referrer but no UTMs, so without it they get lumped into "organic" or "direct" in the CRM. Our guide to tracking AI traffic in GA4 lists the hostnames to watch for.
How do you connect website analytics to a CRM, step by step?
You connect website analytics to a CRM in six steps: agree UTM rules, capture source on the first visit, add hidden fields to every form, populate them on submit, map them to CRM properties and build the reports. The work is mostly configuration, with a small script on the site.
Agree a UTM convention
Write down allowed values for utm_source, utm_medium and utm_campaign, in lowercase, and share a link builder sheet. Inconsistent tags like "LinkedIn", "linkedin" and "li" are the most common reason CRM source reports are unreadable.
Capture first-touch data in a cookie
On every page load, check for an existing first-touch cookie. If there isn't one, read the UTMs from the URL, the document referrer and the landing page path, and store them in a first-party cookie with a long expiry.
Add hidden fields to every form
Add hidden inputs for each field in the table above to demo, contact and trial forms. Name them to match the CRM properties you'll create.
Populate the fields on submit
When the form loads or submits, fill first-touch fields from the cookie, last-touch fields from the current URL and referrer, and the GA4 client ID from the _ga cookie.
Map fields to CRM properties
Create matching contact properties, and copy the key ones to the deal when it's created. Set first-touch properties so they're only written if empty.
Build pipeline and revenue reports
Report opportunities created, pipeline value and closed-won, grouped by first-touch source, last-touch source and self-reported source, side by side.
How does the setup differ in HubSpot and Salesforce?
HubSpot does much of this automatically: its tracking code records original source, drill-down details and page views, and attaches them to the contact when a HubSpot form is submitted. Salesforce has no built-in website tracking, so the hidden-field approach, or a marketing automation tool on top, carries the source data in.
Task | HubSpot | Salesforce |
|---|---|---|
Website tracking | Tracking code records visits and source automatically | Not built in; needs hidden fields or a marketing tool |
Original source | Set automatically on the contact | Custom fields populated by your hidden fields |
Non-native forms | Use the Forms API and pass the hubspotutk cookie | Web-to-Lead or an API integration with hidden fields |
Campaign reporting | Campaigns tool and UTM-based source reports | Campaigns and campaign influence |
Self-reported field | Custom contact property | Custom lead and contact field |
Even on HubSpot, add your own first-touch landing page, referrer and self-reported fields. HubSpot's built-in source buckets are useful but coarse, and they don't separate AI referrals cleanly. If you're thinking of moving the website off HubSpot while keeping the CRM, our guides to leaving HubSpot CMS and HubSpot CMS alternatives that keep your CRM explain how to preserve this tracking.
Joining CRM outcomes back to GA4
Passing the GA4 client ID into a hidden field gives you a key that links a CRM record to the analytics user who converted. With it, you can export closed-won deals and import them into GA4 as offline events, or send them through the Measurement Protocol, so GA4 reports can show which sources led to revenue, not just form fills.
This is optional and takes developer time to do well. It's worth it once you have enough closed deals per quarter to see patterns, and when your team works mainly in GA4. If your team lives in the CRM, reporting there is simpler. Either way, check your consent setup first: only collect the client ID where the visitor's consent choices allow analytics cookies.
How do you check the connection works?
Check the connection by running test conversions through each traffic source and confirming the CRM records match. Do it at launch and again after any site change, because redesigns and form swaps are a common way hidden fields break without anyone noticing.
- Open the site in a private window with a test UTM link, browse two pages, and submit a demo form.
- Confirm the contact in the CRM shows the test source, campaign, landing page and conversion page.
- Return a day later from a different source, submit another form, and confirm first-touch values didn't change while last-touch values did.
- Repeat with a visit from a link on chatgpt.com to confirm the referrer is captured.
- Delete the test contacts afterwards so they don't distort reports.
If you're migrating the site, add this test to the launch checklist. Our guide to analytics continuity in a migration covers the rest of the tracking that tends to break.
What can you report once analytics and CRM are connected?
Once analytics and CRM are connected, you can report pipeline and revenue by source, by landing page and by campaign, and compare what software tracked with what buyers told you. Those are the reports that change budget decisions.
- Pipeline by first-touch source: which channels introduce the buyers who become opportunities.
- Closed-won by conversion page: which pages close deals, which tells you where design and copy effort pays.
- Deal size by source: some channels produce fewer but larger deals.
- Tracked versus self-reported: where AI research and referrals drive deals that analytics files as Direct. See self-reported attribution.
- Journey by stage: which pages buyers visit before becoming opportunities, as mapped in our guide to the B2B buyer journey on your website.
If you're tempted to add a multi-touch attribution tool on top, read multi-touch attribution for B2B first. With this connection in place, many teams find the simple reports answer their questions.
