You are here:
Track User Engagement with Google Analytics 4
For insights into page visits and user engagement, add Google Analytics 4 to your enhanced LWR site from Experience Builder.
Required Editions
| Available in: Salesforce Classic and Lightning Experience |
| Available in: Enterprise, Performance, Unlimited, and Developer Editions |
| Applies to: LWR sites |
| User Permissions Needed | |
|---|---|
| To create an Experience Cloud site: | Create and Set Up Experiences AND View Setup and Configuration |
| To customize or publish an Experience Cloud site: |
|
If you don’t have a Google Analytics account, refer to the GA4 documentation from Google to set one up. You must create a GA4 property with a Web data stream.
Google Analytics 4 allows users to track specific user interactions with page content. These interactions are called events. The out-of-the-box integration tracks certain events, including:
- Page views
- Scrolling
- File downloads
- Outbound clicks, which occur when a visitor selects a link that takes them to a separate domain.
If you want to track other events, you can develop your own using custom events. For more information about events, see [GA4] Enhanced Measurement Events.
- In Experience Builder, go to Settings and select Integrations.
- For Google Analytics 4, click Add to Site.
- Enter your Google Analytics Measurement ID, and save the change.
- Publish the site. Google Analytics begins tracking user engagement after you publish.
To stop Google Analytics from tracking user engagement, you can remove it from the site. Existing data for the site is still available in your Google Analytics account.
You can also change the Google Analytics Measurement ID. On the Integrations page, click Edit for Google Analytics 4, and enter a different Measurement ID. Then publish the site.
For testing purposes, you can publish the site from a sandbox or Developer Edition org. However, we recommend that you wait until you can deploy your site to production before you make it available to the public.

