Categories

System Admin
DXM
Documents
Data

Links

How do I add a Pardot Tracking code to my Website?

Overview

Pardot tracks visitor and prospect activities on your website and landing pages by setting cookies on their browsers. Cookies are set to remember preferences (like form field values) when a visitor returns to your site. Naturally, this is something that our clients might want to implement on their websites.

Table of Contents

Get a tracking code

Each Pardot campaign has a unique tracking code that tracks visitor and prospect activity when added to your web pages.

  1. In Pardot, navigate to the campaign you want to track.

  2. Click View Tracking Code. Copy the code.

Salesforce article

The code is a snippet of Javascript which can be pasted into any web page.

Add the tracking code in DXM

There are two ways to add the tracking code to your sites: by manually adding to a site page or template, or using Google Tag Manager.

Adding to a site page or template

Pardot instructs you to add the tracking code before the close body tag ().

In DXM WordPress we use Elementor to manage all content, so we are not able to directly edit the HTML to place the code. Instead, we have an Elementor widget that allows us to add HTML and Javascript to a page or template.

Where you add the code to the site will be dependent on how the site has been implemented with Elementor. However, sites will typically have a template(s) for a footer which is a good choice for a place to add the code because:

  • it appears across all pages of a site

  • is close to the closing body tag

Access WordPress admin for a site instance via DXM.

  • Navigate to My Sites > [Site Name] > Dashboard

  • Navigate to Templates > Theme Builder > Footer tab

  • Edit the appropriate footer template with Elementor

  • Search for HTML & JS widget in the widget panel

  • Drag the widget on to the template

    • Since there is no visible element, the placement is not too important, but towards the bottom would be a good idea.

  • In the Javascript area paste the tracking code without the surrounding scripttags

    • Script tags are added by the widget

  • Save and publish

Repeat the steps for additional sites in the network as required.

Add the tracking code with Google Tag Manager

You can use Google Tag Manager with your Pardot tracking code. Google Tag Manager does not affect Pardot tracking, provided you set your filters to allow the Pardot tracking code to fire on the pages you wish to track with Pardot. You simply need to create a tag in Google Tag Manager that contains your Pardot tracking code.

Salesforce help article

Using this method requires that you have set up Google Tag Manager in DXM WordPress.

Setup for Google Tag Manager in DXM WordPress

Access WordPress admin for a site instance via DXM.

If setting up a container for the entire network:

  • Navigate to My Sites > Network Admin > Settings > Network Google Tag Manager

  • Add the Container ID

If setting up a container for an individual site:

  • Navigate to My Sites > [Site Name] > Dashboard

  • Navigate to Settings > General > Google Tag Manager

  • Add the Container ID