On this page
What this issue is
Call tracking tools such as CallRail or CallTrackingMetrics give you a pool of phone numbers. A small JavaScript snippet on your site looks for your normal number (the swap target) in the page, then replaces it with a tracking number tied to the visitor's source, such as a Google Ads click or an organic visit. This is called dynamic number insertion, or DNI.
Why it costs you leads or sales
Calls still arrive, so nothing looks broken. But you lose the link between the call and the campaign. Reports show calls as direct or unknown, call conversions do not reach your ad platforms, and you cannot tell which keywords or ads bring phone leads. Budget then moves to the wrong places, and ad bidding learns from less data.
- Ad clickVisitor lands with a source
- DNI scriptCannot find or replace the number
- Default number shownSame number for everyone
- Call reportsSource unknown
- Ad platformNo call conversion data
The swap fails, so the call cannot be tied back to the ad.
Example: share of calls with a known source before and after fixing the swap. Numbers are illustrative.
How to check if your site has it
Open a private window
Use incognito so cached numbers and cookies do not interfere. Accept cookies if a banner appears, since many call tracking scripts wait for consent.
Arrive with a trackable source
Visit your page with a test parameter, such as ?utm_source=google&utm_medium=cpc, or follow a real search link. Check your call tool's docs for which sources trigger a swap.
Compare the number
Look at the number in the header, footer, and contact page. It should differ from your default number.
Inspect the script
Open browser DevTools, then the Network tab, reload, and search for your call tracking vendor's domain. Check that the script loads with status 200. Look at the Console tab for errors.
Check the page source
Right-click the number, choose Inspect, and see whether the text matches your swap target exactly, including spaces, dashes and brackets.
How to fix it
| Cause | What you see | Fix |
|---|---|---|
| Script missing on some pages | Swap works on the home page only | Add the snippet to the site-wide header or tag |
| Number format mismatch | Script loads, number unchanged | Make the page number match the swap target exactly |
| Number in an image or iframe | Number never changes | Use real text in the page |
| Consent tool blocks script | Swap works only after accepting | Review consent category for the call tracking script |
| Caching or minify tools | Script delayed or removed | Exclude the script from optimisation |
| Number added later by JavaScript | Swap runs before number exists | Check vendor settings for dynamic content |
Add the snippet site-wide
Paste the vendor's snippet in your theme header or a header-scripts plugin so it loads on every page, not one template.
Exclude it from optimisation
In your caching or performance plugin, exclude the call tracking script from delay, defer and combine settings, then clear the cache.
Use plain text numbers
Make sure the number is text in the block or widget, not an image, and matches the swap target.
Add to theme.liquid
In Online Store, Themes, Edit code, paste the snippet before the closing head tag in theme.liquid.
Check the number text
Edit the header and footer sections so the number is plain text matching the swap target.
Create a Custom HTML tag
Paste the vendor's snippet into a Custom HTML tag and trigger it on All Pages, or on Initialization if the vendor advises.
Check consent settings
If you use Consent Mode or a consent tool, make sure the tag's consent requirement is intentional.
Publish and test
Use Preview mode to confirm the tag fires, then publish.
Add to project settings
In Project settings, Custom code, paste the snippet in Head code, then publish the site.
Match the number
Use a text element for the number, with the same formatting as the swap target.
Add tracking code
Paste the snippet in the funnel or website settings under tracking code (header), for each funnel or site.
Check each page
Confirm the number appears as text and matches your swap target on every page.
Add a custom code snippet
In Settings, Custom code, add the snippet to the Head, apply it to All pages, and publish. Custom code needs a paid plan with a connected domain.
Use text elements
Keep the number in a text element, not an image.
Use Code Injection
In Settings, Developer Tools, Code Injection, paste the snippet in the Header field. This needs a plan that allows code injection.
Match the number
Edit header and footer text so the number matches the swap target.
Load the script early
Place the vendor's script in the head of a shared template so every page includes it.
Render the number in HTML
Output the number as text. If it is added later by JavaScript, run the swap after it appears.
How to confirm it's fixed
- In a private window with a test source, the page shows a different number from your default
- The swap works on the home page, a landing page, and the contact page
- The swap works on mobile as well as desktop
- The vendor script loads with status 200 and the Console shows no errors
- A test call to the swapped number appears in your call tool with the right source
- A visit with no source still shows the right fallback number
How to prevent it happening again
- Re-test the swap after every theme change, redesign, or new landing page
- Keep the swap target in one place and reuse it in the header, footer, and content
- Do not change how the number is written without updating the swap target
- Review consent and caching settings after plugin updates
- Ask your call tracking tool to show swap status or session counts, and watch for drops
- Test new landing pages before ads are sent to them
How FunnelGuard handles this
FunnelGuard does not check for this yet. It does not test whether your call tracking script swaps the number. A DNI check is a possible future addition.
What FunnelGuard does do 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 your inbox and CRM. That covers the form and click side of your funnel, not the phone number swap.
Questions people ask
Why is my call tracking number not changing on my website?
The most common causes are that the script is not loaded on that page, the number on the page does not match the swap target in your call tool, or a consent tool is blocking the script. Check the Network tab in DevTools to see if the script loads, then compare the number text to your settings.
How do I test dynamic number insertion?
Open a private browser window, accept cookies, and visit your page with a trackable source such as UTM parameters or a real ad link. The number should differ from your default. Then call it and check your call tool logs the right source.
Why does the DNI swap work on some pages but not others?
The script is probably only installed on some templates, or the number on the failing pages is written differently or sits inside an image or iframe. Add the snippet site-wide and use plain text in the same format on every page.
Can a cookie banner stop the phone number from swapping?
Yes. If the call tracking script is set to load only after consent, visitors who have not accepted will see the default number. Decide which consent category the script belongs to and test both accepted and declined states.
Does a caching or speed plugin break dynamic number insertion?
It can. Options that delay, defer, combine or minify JavaScript may postpone or break the swap script. Exclude the call tracking script from those settings, clear the cache, and retest.
Why do my calls show as unknown source?
Often the visitor saw the default number because the swap failed, so the call could not be linked to a session. Fix the swap, then test with a real call to confirm the source is recorded.
Does FunnelGuard check if my DNI number swap works?
No. FunnelGuard does not check dynamic number insertion yet; it is a possible future check. It monitors forms, checkouts, booking and chat buttons, tracking hits and lead delivery, so test the number swap by hand for now.
Related issues
- TRK-250DNI swap fails on mobile tel: linksFix guide
- TRK-251DNI swaps the number in visible text but not the tel: hrefFix guide
- TRK-252DNI pool exhausted, everyone sees default numberFix guide
- TRK-253Call tracking number disconnectedFix guide
- TRK-254CallRail/CallTrackingMetrics script blocked by consentFix guide
- TRK-255Call conversions not sent back to Google AdsFix guide