This article covers installing the phone-number-swap script that shows each visitor the right tracking number for the channel that brought them in — for one location or several.
Read this whole article before installing. Always add the script in staging first, confirm it behaves correctly, then publish to the live site.
—What's different from the old script
The old DNI script is retired. The new one does the same job — swap the displayed number for ad-attributed visitors — but it's simpler to install and covers more cases automatically. If you've installed the old version before, here's what changed:
Old script
Whole script pasted into custom code, one copy per site
Only detected Google Ads, via a custom ?network=g parameter
Single & multi-location used two different code blocks
Phone number format had to match exactly, or replacement could fail
Tracking flag never expired once set
New script
One hosted script + a short config block, same for every site
Reads standard utm_source — Google, Facebook, or any channel you define
Single & multi-location use the identical setup, just a longer config
Matches parens, dashes, dots, or bare digits automatically
Attribution expires after a config-set window, then falls back to the default number
01Preparation
If you're unsure about anything below, contact the technology team before publishing to a live site.
Understand the goal: when a visitor arrives with a recognized utm_source value in the URL (for example ?utm_source=google), the script swaps every occurrence of the site's phone number for that channel's call-tracking number — and keeps showing it on later pages, for a limited time.
What you'll need:
Access to WebFlow for the site.
The site's current phone number(s).
The call-tracking number for each channel you want to track (Google, Facebook, etc.), from your call-tracking platform.
02Identify the phone number(s) on the site
Before installing, note every place the phone number appears:
In text — anywhere the number is printed on the page, in any format.
In tel: links — clickable numbers such as href="tel:9549724208".
You no longer need to standardize formatting first. The new script recognizes (954) 972-4208, 954-972-4208, 954.972.4208, 9549724208, and versions with a leading 1 or +1 — all as the same number. Whatever format each instance is already in, that's the format it stays in after swapping.
If the site has more than one location, note which number belongs to which office — you'll list each one separately in the config.
03Open the WebFlow custom code settings
Log in to WebFlow and open the site's project.
Decide the scope. For a single page, open that page's Settings (gear icon) from the Pages panel. For the whole site, go to Project Settings → Custom Code instead.
Find the footer field. You'll paste the install snippet into Before </body> tag (page-level) or the Footer Code section (site-wide).
04Add the script and config
Unlike the old script, you're not pasting in the whole program — the script itself is hosted and shared across every site. You only add a small config block, then load the script:
utmMap — one entry per channel you want to track. The key is the utm_source value from your ad URLs (lowercase); the value is that channel's call-tracking number.
Multi-location site
Add one object to groups per office. Everything else about the install is identical:
Every visitor's channel applies to every location at once. If someone arrives via ?utm_source=google, Miami's number swaps to Miami's Google number and Tampa's swaps to Tampa's Google number, in the same page load. You don't need separate logic per office — the script matches each location's own current number on the page and looks up the right replacement for it.
A location doesn't need a mapping for every channel — Orlando above only tracks Google. Any channel without an entry just keeps showing that location's defaultNumber.
05Config field reference
Field
Required
Description
expirationDays
Yes
How many days a visitor's channel is remembered across page views before the site reverts to default numbers. 30 is a reasonable starting point for most call-tracking windows.
groups
Yes
One entry per phone number on the site. At least one is required, even for a single-location site.
groups[].name
Recommended
A label for the location, for your own reference. Must be different for every group on the same site.
groups[].defaultNumber
Yes
The number currently live on the site for this location, in any format.
groups[].utmMap
Yes (can be empty)
Maps a utm_source value (lowercase) to the call-tracking number to show for that channel.
06Testing
Test with a tracked URL. Open the page with ?utm_source=google appended (e.g. https://www.example.com/?utm_source=google) and confirm every visible instance of the number changes, in whatever format it was already in — and that any tel: links update too.
Test page navigation. Click through to other pages on the site and confirm the tracking number keeps showing, without the parameter in the URL.
Test with no parameter. Open the site fresh (or in a private window) with no utm_source at all, and confirm the original number is shown.
Test each channel you configured (?utm_source=facebook, etc.) the same way.
07Troubleshooting
Number isn't swapping
Open the browser console and look for a warning starting with [dynamic-number-swap] — it names exactly what's wrong with the config (a missing field, a bad number, a duplicate location name).
Confirm the config <script> block comes before the <script src="...dynamic-number-swap.js"> tag — the config has to exist before the script reads it.
Confirm the utm_source value in the URL matches a key in that location's utmMap exactly (matching is case-insensitive, but the source still has to be one you configured).
Confirm defaultNumber matches what's actually printed on the page — the script only swaps numbers it can find.
Right location swaps, wrong number appears
Check for two groups with the same name — the script will refuse to run and warn in the console rather than guess which one you meant.
Changes not visible
Clear your cache or use a private window to make sure you're viewing the published version.
Confirm you clicked Publish in WebFlow, not just Save.
08Maintenance
Adding a location
Add a new object to the groups array, following the same shape as the others. Separate it from the previous entry with a comma, and give it a name no other group on the site is using.
Removing a location
Delete its entire object, from the opening { to the closing }. If it wasn't the last entry in the array, remove the trailing comma too.
Updating a number
Edit the relevant defaultNumber or utmMap value in place, then re-publish. No other part of the config needs to change.