Implementation of Google Tag Manager For Salesforce Communities
Without depending upon the developer, your marketing team can deploy marketing tags and tracking pixels. Google Tag Manager gives you permission to track video views, form inputs, scrolling, events, and many other factors that can tell what users are doing in your community with the functionality provided by you. This will help you in understanding how the functionality provided by you is helping the users for better understanding and whatever the actions they wanted to do is completing quicker and easier.
One of the most common challenges faced is whenever we are integrating Salesforce with Google Tag Manager, the configuration is required on both sides to integrate them in order to function properly.
I will show you step-by-step to configure Google Tag Manager and Salesforce Community Builder in order to successfully setup integration between both of them.
Don't forget to check out: Salesforce Lightning:map - Show Locations on Google Map
Step 1: Get GTM Tracking Script
- To do that firstly, create a new Google Tag Manager for your Salesforce Community.
- Login to Google Tag Manager.
- Create an account and web container for your Salesforce community if not created already.
- Go to the container you have created for your Salesforce Community.
- Click the code prefixing with “GTM-”.
Step 2: Setup Google Tag Manager
- For the Setup of Google Tag Manager, configure triggers because there are certain events such as page views, HTML element clicks when to fire them can only be known in Salesforce Community Web App.
- In Google Tag Manager, you will find Triggers in the left menu.
- When finished configuring Google Tag Manager triggers, next you will configure tags.
- Configuring tags provides flexibility for custom tags or any third party tags for the implementation of code.
- If you want any tag to be fired, configure the minimum of one trigger for a tag.
Step 3: Setup Content Security Policies and Trusted Sites in
Salesforce Community Builder
- If Content Security Policies in Community Builder are not properly configured, might be some functions of Google Tag Manager do not properly work.
- Now giving you the steps for setting up.
- In the same browsing session, Click Settings and then security.
- From the picklist of Script Security Level, pick Allow Inline Scripts and Script Access to Whitelisted Third-Party Hosts.
Check out another amazing blog by Deepak here: Requirements for Approval Process in Salesforce - All You Need to Know
Step 4: Set Google Tag Manager script to Salesforce Community
- Under Settings, Click on Advanced.
- You can paste your Google Analytics Tracking Id here.
- Under heading Head Markup, click on Edit Head Markup and paste the Google Tag Manager Tracking Script Code, you obtained in Step1.
- Click save and now you can publish to the community.
Finally, you can also test and debug whether Google Tag Manager which you have implemented is properly working or not. To do that Log into your account, then Preview mode on, then access the Salesforce Community within the same browsing session.
If you have followed all the steps, then not only have you successfully implemented Google Tag Manager integration but also able to track various events as we discussed earlier.