Getting Started with the Tracking and Consent JavaScript API

Before you get started, the Tracking and Consent API must be enabled on the account.

  • In Pardot

    1. Go to Settings.
    2. Click “Edit”.
    3. Select “Activate the Tracking & Consent JavaScript API”.
  • In the Pardot Lightning App:

    1. Select Pardot Settings.
    2. Click “Edit”.
    3. Select “Activate the Tracking & Consent JavaScript API”.

To get started, add Pardot analytics to your site. This snippet adds Pardot analytics to your page and records a page view when the library loads. Replace the piDomain with your specific account information. Add the snippet to any page you’d like to collect Pardot analytics on.

Set the piDomain to a verified Pardot tracker domain in your account. This tracker domain must be a subdomain of the tracked page. For example, adding the snippet to example.com must use a piDomain with the root domain of subdomain.example.com.

The Pardot analytics javascript library is loaded asynchronously and establishes an empty analytics action queue if one doesn’t exist.

Next, add some analytics actions to be processed after the library has loaded. Create an analytics tracker, and send a page view to Pardot. When a visitor views the page, a tracked page view is sent to Pardot. If the page visitor is in a geo that requires consent as defined in your Pardot account settings and hasn’t yet opted in, the page view isn't recorded. Instead, the consent banner is shown.

Analytics actions are always processed in order after the Pardot analytics library has loaded. Additional actions are processed synchronously after the queue has been processed. See Tracking and Consent Functions for additional actions you can take with Pardot analytics.