Skip to content
FunnelGuard

Fix guide by FunnelsGuard

DNI swaps visible number but not the tel: link: how to fix it

TRK-251High impactDetectedBy FunnelGuardPublished Updated
On this page

What this issue is

Dynamic number insertion (DNI) is a script from a call tracking vendor. It shows each visitor a tracking phone number based on where they came from, such as a Google Ads click or an organic visit. Calls to that number are then credited to that source.

A phone number on a page often lives in two places: the visible text (555 0100) and the link target (<a href="tel:+15550100">). This issue happens when the script updates the text but leaves the href alone. On a desktop, people read the number and dial it, so it looks fine. On a phone, people tap the link and dial the old number.

What the broken markup looks like after the swaphtml
<!-- Visible text was swapped, href was not -->
<a href="tel:+15550100">+1 555 0199</a>
<!-- Text shows the tracking number (0199), tap dials the default number (0100) -->

Why it costs you leads or sales

Phone calls are often your highest value leads, and most click-to-call taps happen on mobile. If the tap dials the default number, the call lands in the wrong bucket (often "direct" or "unknown"). Your reports then undercount calls from paid campaigns.

Where the call is lost
  1. Ad clickVisitor lands with gclid or UTMs
  2. Script swaps textVisible number becomes the tracking number
  3. href unchangedtel: link still holds the default number
  4. Tap to callDials the default number
  5. Call reportCall not tied to the campaign

The visitor sees the right number, but the tap uses the default one.

Calls credited to the campaignExample numbers
Calls credited to the campaign (example)Real campaign calls: 100 calls; Credited (href broken): 30 calls; Credited (fixed): 100 calls0387710030100Real campaign callsCredited (href broken)Credited (fixed)calls

Example: 100 calls actually came from a paid campaign, 70 of them by tapping a link on mobile. With the href not swapped, only the typed calls are credited.

How to check if your site has it

Check the text and the link
  1. Open the page with campaign parameters

    Use a private window and add the parameters your vendor uses, for example your landing page URL with ?gclid=test&utm_source=google&utm_medium=cpc. Wait a few seconds for the script to run.

  2. Note the visible number

    Compare it with the default number you see on the page without parameters. It should differ if the swap works.

  3. Inspect the link

    Right-click the number, choose Inspect, and read the href on the <a> tag. It should start with tel: followed by the same tracking number as the text.

  4. Test on a phone

    Open the page on a phone, tap the number and look at the number in the dialler before you press call. Do not place the call unless you intend to.

  5. Check every spot

    Repeat for the header, sticky call button, footer and any button or icon that links to a phone number.

Console check: list every tel: link and its textjavascript
document.querySelectorAll('a[href^="tel:"]').forEach(a => {
  console.log(a.textContent.trim(), '->', a.getAttribute('href'));
});

How to fix it

The exact fix depends on your call tracking vendor, because each script finds numbers in a different way. Most look for the default number written as text, and many only update an href when the link follows a specific pattern. Check your vendor's documentation for the swap class or attribute they support.

Fix the swap
  1. Match the number format exactly

    Many scripts look for the default number in the exact format set in your dashboard. Make the href use the same digits, for example tel:+15550100, and make sure the number you configured matches the one in your markup.

  2. Use your vendor's swap class or attribute

    Add the class or data attribute your vendor documents to the link, so the script knows to update both the text and the href.

  3. Keep the number as plain text in the link

    Numbers split across tags, or set by CSS or an image, may be missed. Put the full number as text inside the <a>.

  4. Handle late-loaded elements

    If the link is added after page load (popup, sticky bar, tabbed content), check that your vendor supports dynamic content, or trigger its re-scan after the element appears.

  5. Re-test with parameters

    Repeat the check above on desktop and a phone.

Where to change the markup
  1. Find the link

    Check the page editor, the theme header and any builder widget (Elementor, Divi). Button and icon widgets often store the number only in the link field.

  2. Add the swap class

    Add the vendor's class in the Advanced or CSS Classes field of the button, or edit the link in the Code editor.

  3. Clear caches

    Purge page and CDN caches, and check that the script is not delayed or deferred by an optimisation plugin.

Fallback: keep the href in line with the swapped textjavascript
// Run after the call tracking script has swapped the text.
// Only use this if the vendor has no built-in way to update href.
document.querySelectorAll('a.js-phone').forEach(function (a) {
  var digits = a.textContent.replace(/[^0-9+]/g, '');
  if (digits) a.setAttribute('href', 'tel:' + digits);
});
Link before and after the fix

Before

  • Text shows the tracking number
  • href holds the default number
  • Taps on mobile dial the default number
  • Calls show as direct or unknown

After

  • Text and href show the same tracking number
  • Taps dial the tracking number
  • Calls are credited to the visitor's source
  • Call conversions can reach your ad platform

How to confirm it's fixed

Confirmation checklist
  • With campaign parameters, the visible number differs from the default
  • The console check shows matching digits in text and href for every tel: link
  • Tapping the number on a phone shows the tracking number in the dialler
  • Header, sticky button, footer and popups all behave the same
  • A test call appears in your call tracking dashboard with the right source
  • Without parameters, the default number shows in both text and href

How to prevent it happening again

Prevention habits
  • Add the tel: link check to your release checklist whenever you edit headers, footers or page templates
  • Use one reusable phone component instead of pasting numbers in many places
  • Do not swap a text-only number for an image or icon-only button without testing the link
  • Re-test after changing themes, page builders, caching or script optimisation plugins
  • Place a test call once a month from a phone and compare the source in the dashboard

How FunnelGuard handles this

FunnelGuard does not check this yet. Comparing the visible number with the tel: link after a swap is a possible future check, not something it does today.

What FunnelGuard does today is run your real customer journeys on a schedule, such as lead forms, checkouts, and booking and chat buttons, and check each step, the tracking hits sent to ad and analytics platforms, and whether test leads reach the inbox and CRM. That can show a broken step on a page that holds your phone button, but it will not tell you the href is stale.

Questions people ask

Why is my call tracking number changing on the page but not when I tap it?

The script is updating the visible text but not the href of the tel: link. On a phone, tapping uses the href, so it dials the default number. Add your vendor's swap class or make the link match the format the script looks for.

How do I check if my tel: link is being swapped by DNI?

Open the page in a private window with campaign parameters, right-click the number and choose Inspect. The href should start with tel: and the tracking number shown in the text. You can also list all tel: links in the browser console and compare them with their text.

Why are my mobile calls showing as direct in call tracking?

One common cause is that tapped links still use the default number, so the call cannot be linked to the visitor's source. Check that the tel: href is swapped as well as the visible text. Other causes include a script blocked by consent or a pool of numbers running out.

Does dynamic number insertion update the href automatically?

It depends on the vendor and on how your markup is written. Many scripts update links only when they find the default number in a specific format or when the element has a documented class. Read your vendor's setup guide and test the result.

Can I fix a tel: link that DNI ignores with JavaScript?

Yes, as a fallback. After the swap runs, read the number from the link text and set the href to tel: plus those digits. It must run after the vendor script, and a built-in vendor method is better where it exists.

Why does the swap work on desktop but calls fail on mobile?

Desktop visitors usually read the number and dial it, which uses the swapped text. Mobile visitors tap the link, which uses the href. If only the text is swapped, mobile calls are not attributed.

Does FunnelGuard check whether the tel: link matches the swapped number?

No. That check is not available yet and is a possible future addition. Until then, use the console check and a phone test, and review call sources in your call tracking dashboard.

Does FunnelGuard catch this?

Detected

FunnelGuard checks for this today.

How: dni_swap: visible number swapped but tel: link not -> fails (Stage 21).

Stop finding out from your customers

FunnelGuard runs your real forms and checkouts on a schedule, checks the tracking and the leads behind them, and alerts you once, with a screenshot. Try any paid plan free for 3 days.