Quick, practical guide to set up Google Analytics 4 (GA4) for Experience Cloud sites so you can track user types, user IDs, search activity, and page views.
Big idea
Google Analytics 4 (GA4) uses an event-driven model to capture user interactions across websites and apps. For Experience Cloud sites, integrating GA4 lets you measure logins, searches, and pageviews — plus Salesforce-specific values such as user IDs and user types — to make data-driven improvements to your digital experiences.
Before you start
Make sure you have Google account access and administrative access to your Experience Cloud site (Experience Builder). This guide covers creating a GA4 property and web data stream, copying the Measurement ID, and wiring it into Experience Cloud settings.
Step-by-step setup
- Create a Google Analytics 4 account: Sign into Google Marketing Platform and follow the prompts to create a new GA4 account if you don’t already have one.
- Create a GA4 property: In Google Analytics, go to Admin → Property → + Create Property and follow the business details and objectives flow.
- Create a Web data stream: Admin → Property Settings → Data Streams → Add Stream → Web. Enter your Experience Cloud site URL, enable Enhanced Measurement if desired, and copy the Measurement ID (formatted like G-XXXXXXXXXX).
- Update Experience Builder settings:
- Open Experience Builder for your site and navigate to Settings → Security & Privacy.
- Set Content Security Policy to Relaxed CSP: Permit Access to Inline Scripts and Allowed Hosts.
- Go to Settings → Advanced and paste your GA4 Measurement ID into the Google Analytics field.
- Enable Let Google Analytics access your Salesforce data for deeper insights into search activity to allow tracking of user IDs, user types, and search terms.
- Publish the site so tracking starts flowing into GA4.
- Verify tracking: In GA4 go to Reports → Realtime, open your Experience Cloud site in a new browser, and confirm your activity (page views, location, events) shows up in real time.
Best practices & considerations
- Respect privacy and cookie consent: GA4 is privacy-friendly, but ensure your site’s privacy notices and consent banners reflect data collection.
- Use descriptive event names and parameters if you extend tracking (search queries, custom object pageviews).
- Monitor GA4’s DebugView during testing to inspect events as they fire.
- Consider tagging pages or flows to segment experience by user type (guest vs. logged-in user).
Proof of concept
Open GA4 Realtime reports and visit your Experience Cloud site after publishing. If you see active users and pageviews, the integration is successful. With the Salesforce data access option enabled, GA4 will also surface user-type and search-specific values in your reports.
Why this matters for Salesforce teams
Admins, developers, and business users gain actionable visibility into how customers and employees interact with Experience Cloud sites. Tracking user IDs, search behavior, and page-level engagement helps prioritize content, optimize search, and measure adoption — turning site activity into product and support improvements.
Key takeaways:
- GA4 uses event-based tracking and is suited for modern privacy-first analytics.
- Experience Builder allows direct insertion of the GA4 Measurement ID and optional Salesforce data sharing for deeper insights.
- Verify via GA4 Realtime and DebugView before rolling out to production.
For more detailed screenshots and a walkthrough, follow the original Automation Champion post referenced by the team and test in a sandbox site first.








Leave a Reply