Salesforce Sites provides out-of-the-box integration with Google Analytics. To track
the usage of your sites and site pages, use Google Analytics. You can track the number of
visits, the number of page views, the average time spent on the site, and more.
Required Editions
Available in: both Salesforce Classic and Lightning Experience
Available in: Developer, Enterprise, Performance, and
Unlimited Editions
User Permissions
Needed
To create and edit Salesforce Sites:
Customize Application
OR
Create and Set Up
Experiences
Note The <site:googleAnalyticsTracking/>
component only works on pages used in a Salesforce Site. Sites must be enabled for
your organization and the Analytics Tracking Code field must be
populated. To get a tracking code, go to the Google Analytics website.
Add a profile in Google Analytics and enter the domain or full URL for the site
you want to track.
Copy the Web Property ID from Google's tracking status
information. Then paste that value into the Analytics Tracking
Code field on the Site Edit page for the site that you want to
track.
The Web property ID starts with the letters UA followed by your account and
profile numbers. For example, UA-9049246-2.
Save your changes.
To track the Visualforce pages associated with your site, enter the following
tag in the site template for those pages, or in the individual pages
themselves.
<site:googleAnalyticsTracking/>
For a page to be tracked, this tag is required either in the page or the
associated page template. The default site template already contains the
tag, so all pages that use that template are tracked—including
certain default pages.
Note Google recommends adding the component at the bottom of the page to avoid
increasing page load time.
Go to the Google Analytics site and follow their instructions for completing
the process.
After you sign up, it can take up to 24 hours before you see initial
tracking results in Google Analytics.
Tip To track multiple sites separately, create separate profiles using the
full site URLs and enter a different Web property ID in the Analytics
Tracking Code field for each site.
We use three kinds of cookies on our websites: required, functional, and advertising. You can choose whether functional and advertising cookies apply. Click on the different cookie categories to find out more about each category and to change the default settings.
Privacy Statement
Required Cookies
Always Active
Required cookies are necessary for basic website functionality. Some examples include: session cookies needed to transmit the website, authentication cookies, and security cookies.
Functional Cookies
Functional cookies enhance functions, performance, and services on the website. Some examples include: cookies used to analyze site traffic, cookies used for market research, and cookies used to display advertising that is not directed to a particular individual.
Advertising Cookies
Advertising cookies track activity across websites in order to understand a viewer’s interests, and direct them specific marketing. Some examples include: cookies used for remarketing, or interest-based advertising.