Skip to main content

Dynamic Number Insertion (DNI)

Dynamic Number Insertion replaces the phone number on your website with a unique tracking number for each visitor. This enables per-visitor call attribution — connecting phone calls back to the Google Ads click (gclid) that brought the visitor to your site.

Tier Requirement

DNI is available on the Growth tier and above.

How It Works

  1. Visitor lands on your website — the DNI script captures the gclid, UTM parameters, and referrer
  2. Script requests a tracking number — calls the TrolleyShield API with the visitor's attribution data
  3. Number is assigned — TrolleyShield finds an available DNI pool number and creates a session (30-minute TTL)
  4. Phone number is swapped — the script replaces the displayed phone number on the page
  5. Visitor calls — the call is matched to the DNI session, linking it to the original gclid
  6. Conversion fires — if high-intent, TrolleyShield sends an offline conversion to Google Ads with the gclid

Setup

1. Mark Numbers as DNI Pool

In your dashboard, go to Numbers and mark one or more tracking numbers as DNI Pool. These numbers will be dynamically assigned to website visitors.

tip

Provision enough DNI pool numbers to handle your concurrent website traffic. A good starting point is 3-5 numbers for most sites.

2. Add the DNI Script

Add the following script to your website, just before the closing </body> tag:

<script
src="https://app.trolleyshield.com/dni.js"
data-license-key="YOUR_LICENSE_KEY"
data-phone-selector=".phone-number"
></script>

Attributes:

AttributeRequiredDescription
data-license-keyYesYour TrolleyShield license key (found in Settings)
data-phone-selectorYesCSS selector for elements containing phone numbers to swap

3. Mark Phone Numbers in HTML

Wrap your phone numbers with the CSS class specified in data-phone-selector:

<a href="tel:+15551234567" class="phone-number">
(555) 123-4567
</a>

The script will automatically replace the displayed number and update the href attribute.

Session Behavior

  • Each DNI session lasts 30 minutes from assignment
  • If the visitor doesn't call within 30 minutes, the number returns to the pool
  • If the visitor calls, the session is claimed and linked to the call record
  • Attribution data (gclid, gbraid, wbraid, UTM params) is stored in the session

Troubleshooting

Number not swapping:

  • Verify the data-phone-selector matches your HTML elements
  • Check browser console for script errors
  • Ensure your license key is valid

Conversion not firing after call:

  • Verify the visitor arrived via a Google Ads click (gclid must be present in the URL)
  • Check that the DNI session hasn't expired (30-minute TTL)
  • Confirm Google Ads integration is configured in Settings → Integrations