Skip to main content

Overview

The Pingtree Click Script is a JavaScript tracking script that powers client-side tracking on your landing pages. When installed, it automatically generates a unique Transaction ID for each visitor, tracks click and form events, captures lead data fields, and handles consent token collection — all in real time. The Click Script is the bridge between your landing page and the Pingtree platform. Every lead that flows through the system starts with a Transaction ID generated by this script.

What the Click Script Does

When a visitor lands on a page with the Click Script installed, the script:
  1. Generates a Transaction ID — A unique UUID (v4) is created and stored in the visitor’s browser cookie for the configured cookie duration.
  2. Fires a click event — The script calls the Pingtree click API to register the visitor as a click lead, capturing browser, device, and geolocation data.
  3. Tracks page interactions — As the visitor progresses through the form, the script tracks field completions and form submission events.
  4. Captures custom parameters — Any query string parameters on the landing page URL (UTM params, sub IDs, etc.) are automatically captured and attached to the lead record.
  5. Handles consent tokens — If Jornaya or TrustedForm integrations are enabled, the script retrieves and stores consent tokens alongside the lead.

Script Installation

Add the Pingtree script tag to the <head> of your landing page HTML. The script is campaign-specific and is served dynamically based on the campaign ID (cid).

Standard Tracking Script

<script src="https://your-domain.com/sdk/{cid}/pingtree.js"></script>
Replace {cid} with your campaign’s unique ID (visible in your campaign settings). For pages that display TCPA consent language managed through Pingtree, use the consent script instead:
<script src="https://your-domain.com/sdk/{cid}/pingtree-consent.js"></script>
This variant loads the consent language retrieval logic, enabling Pingtree to dynamically populate consent text on your page based on campaign-level consent settings.
Tip: Place the script tag as early as possible in the <head> section to ensure the Transaction ID is generated before any form interactions occur.

Script URL Reference

ScriptURL FormatPurpose
Main Tracking Script/sdk/{cid}/pingtree.jsClick tracking, Transaction ID generation, form event capture
Consent Script/sdk/{cid}/pingtree-consent.jsConsent language display and TCPA token retrieval
Consent Language API/sdk/get-consent/{cid}/{transaction_id}/{fvid}Retrieves dynamically populated consent language for a specific lead session

What the Script Captures

The script collects and transmits the following data at the time of the click event:

Visitor & Device Data

  • Browser name and version
  • Operating system
  • User agent string
  • IP address
  • Geolocation data (city, state, ZIP code, country) — when geo lookup is enabled for the campaign

URL Parameters

All query string parameters present on the landing page URL are captured, including:
  • pid — Publisher / Source ID
  • sub1 through sub5 — Sub-source identifiers
  • gclid, fbclid, ttclid — Ad network click IDs
  • UTM parameters and any custom parameters configured on the source
When consent integrations are enabled on the campaign:
  • Jornaya: LeadID token captured from the Jornaya script
  • TrustedForm: Certificate URL captured from the TrustedForm script

The Transaction ID is stored in the visitor’s browser cookie so it persists across page navigations within the same session. The cookie duration is configured at the campaign level:
SettingDescription
Cookie DurationHow long the Transaction ID cookie is valid (e.g., 24h, 7d, or a custom value)
Default24 hours if no custom duration is configured
If a visitor returns to the page with an existing Transaction ID cookie, the script reuses the existing ID and increments the click count rather than creating a duplicate lead.

Script Behavior & Configuration

The script’s behavior is controlled entirely by the campaign settings configured in Pingtree. No manual code changes are required after installation. Configuration includes:
  • Ad network integrations: Google Ads, TikTok Ads, Facebook (Meta) — enabled in Campaign Settings > Click Script
  • Consent integrations: Jornaya, TrustedForm — enabled per campaign
  • Sub-parameters: Custom query parameters passed through and attached to the lead
  • Custom fields: Additional data fields captured from the page and appended to the lead record

Event Tracking

The script fires events back to Pingtree at key points in the visitor journey:
EventWhen It Fires
Base Click EventImmediately on page load — registers the visitor as a click lead
Form Submission EventWhen the visitor submits the lead form
Custom EventsAt any point configured via the Event Manager in campaign settings
Each event is logged against the Transaction ID, building a complete audit trail of the visitor’s journey from click to conversion.

Billing Requirement

The Click Script API (/sdk/click) enforces an active billing check before processing requests. If the organization’s account has an unpaid balance or billing is not active, the script will not generate Transaction IDs and click events will be rejected. Ensure your organization’s billing is up to date in Settings > Payment Methods to avoid interruptions to click tracking.

Rate Limiting

Click API requests are subject to the rate limits configured for your organization. If the rate limit is exceeded, requests are rejected with an HTTP 429 Too Many Requests response. Contact your platform administrator to adjust rate limits if needed.