Most of the Sitecore sites are enabled with Google Analytics to capture Users’s behavior. SXA has an OOB component called – Google Analytics(GA) to track. By default, this component may not be enabled and we need to enable manually.
The below are the steps to be followed to enable GA component in SXA.
- The component file is available in the below path : Views\GoogleAnalytics.cshtml
- The below highlighted Key value is taking from the rendering parameter at GA component level.
3. Go to SXA Home node and select “Experience Editor” like this path /sitecore/content/Tenant Folder/New tenant/SiteA/Home
4. Click on TAB : EXPERIENCE ACCELERATOR and Metadata as shown in the below
5. Add the GA component as shown in the below
6. Select the GA component from ANALYTICS TAB.
7. While adding the component add the GA analytics ID as shown in the snap.This value is rendered as Key value in the #step 2
8. Save and Publish.
9. Ready to track the analytics at Google Analytics side.
10. Some times , we can use Google Tag Manager (GTM) to track GA events. I will cover in next topic on GTM in SXA.