Question from user:
I’ve been asked how GA4 metrics and dimensions can be used to enrich our lead data going to Salesforce.
We capture the usual stuff; campaign info, landing page, page they converted and a few custom unique identifiers.Any recs or best practices on how to maximize the data from GA4 to best enrich leads?
Answer from Nabil:
That’s a fantastic question and a great way to start leveraging your GA4 data to its fullest potential.
To really maximize the enrichment of your leads going into Salesforce, you should focus on behavioral and engagement data that provides context beyond the standard conversion details you already capture.
Think about adding metrics like session duration, the number of pages viewed in the conversion session, and the page depth or scroll percentage on key pages to gauge a lead’s interest level.
You could also include user-level metrics that aggregate behavior across sessions before the conversion, such as the total number of sessions, first-visit date, or time since the user’s first visit.
For dimensions, consider the Device Category or Browser to understand technology preferences, or even the Landing Page path again, but enriched with a deeper custom dimension that categorizes the page content (e.g., Product Page - Feature A
versus Blog Post - Category B
).
You might also capture the geographical data like City or Region if it’s relevant to your sales strategy.
Custom dimensions are your best friend here – use them to pass unique internal properties you’ve defined, such as a User Role
or Account Type
if you can infer that from their on-site behavior, perhaps based on what pages they visited or what custom events like view_item_list
or add_to_cart
they triggered, even if they didn’t complete the purchase.
To implement this robust enrichment, a sophisticated data pipeline is necessary, and combining the Salesforce API, the Account Engagement API (if you use Pardot), the Google Analytics Data API, Google Tag Manager, and a service like Stape or Google Cloud Platform creates a truly awesome, flexible, and reliable solution.
Here’s why this combination is a best practice:
The core idea is to move from relying solely on client-side data capture to a secure, server-side data integration.
Google Tag Manager (GTM), when paired with a service like Stape for server-side tagging, ensures that you capture the most accurate and complete behavioral data by reducing reliance on browser-level tracking prevention and ad-blockers.
GTM fires the initial standard events like page_view
and custom events like generate_lead
or form_submit
.
Stape, or your server-side environment, acts as a secure intermediary, receiving this raw data.
When a lead converts, you’re already passing a unique identifier to Salesforce, but this server-side setup lets you augment that identifier with a wealth of associated event parameters and user properties before it leaves your control.
The Google Analytics Data API is crucial because it allows you to pull aggregated, clean, and processed behavioral data directly from GA4.
Rather than trying to cram every single detail into the conversion payload, you can use the lead’s unique ID and Session ID (which you should pass to Salesforce upon conversion) to later query the Data API and retrieve all the desired metrics and dimensions for that specific user’s interaction.
This is where you get the rich history, like total page views or average session duration.
Finally, the Salesforce API and the Account Engagement API are the destinations and the glue.
They allow you to programmatically update the lead record.
A script, hosted on a scalable service like Google Cloud Platform (specifically Cloud Functions or Cloud Run), can be triggered when a new lead is created in Salesforce.
This script uses the lead’s unique identifier to query the Google Analytics Data API, retrieve the aggregated behavioral data, and then uses the Salesforce or Account Engagement API to update the corresponding lead or prospect record.
This makes the data enrichment process reliable, scalable, and independent of client-side cookies or browser limitations, ensuring your sales team has the most complete picture of a lead’s journey the moment they look at the record.