Skip to main content

Return to TX Community

Liaison

Setting up Google Analytics for TargetX Events

Note: These instructions cover setting up Basic Page Tracking with Google Analytics. For more advanced tracking, consult Google Analytics Support

To configure Google Analytics for your Event Registration Forms, see Google Analytics for WebForms.

Step 1: Obtain a Google Analytics Tracking Code​​

  1. You will first need to create an account for the following or login if you have an existing account:​

Note: If you’ve previously set up a Google Analytics Account, you should configure a new Property for your Online Application site.

  1. Google Analytics

    • Google Analytics is a free web analytics tool offered by Google to help you analyze your website traffic.
  2. Google Tag Manager

  3. Google Tag Manager allows you to easily update tags and code snippets on your website. Once the Tag Manager snippet has been added to your website or mobile app, you can configure tags via Google Tag Manager without having to alter and deploy additional code.

  4. Note: Google Tag Manager is ONLY needed for the Online Application setup. For all other setups you will use the Google Analytics Tracking code.
  5. ​​Locate your Tracking code in Google Analytics:
  • Select gear icon
  • Click Tracking Info
  • Click Tracking Code
  1. Copy the code and store it for later use.

Step 2: Configure Events Custom Code

  1. ​Login to your Salesforce Org and navigate to the Events Custom Code tab.
  2. Click the Theme Name used for your Events site.
  3. Select Edit.
  4. Add the following code to the javaScript field (Replace YOUR GA TRACKING ID with your Google Analytics Tracking ID):
</script><!-- Global site tag (gtag.js) - Google Analytics -->
<script async src="https://www.googletagmanager.com/gtag/js?id=YOUR GA TRACKING ID"></script>
<script>
window.dataLayer = window.dataLayer || [];
function gtag(){dataLayer.push(arguments);}
gtag('js', new Date());

gtag('config', 'YOUR GA TRACKING ID');
  1. Save your changes.

Step 3: Configure/Validate Events Settings​

  1. Navigate to Setup and search for Custom Settings.
  2. Select Manage next to Events Settings.
  3. Click Edit next to the custom setting to which you'd like to apply the CSS or Javascript.
  4. Confirm that the exact name of the custom code record you updated above is in the Template Override field.
  5. Click Save.
  • Was this article helpful?