Installing Dynamic Number Insertion

CallRail’s dynamic number insertion feature helps you quickly integrate call tracking in your website. Each tracking number you create can be assigned a source (like Google AdWords, Bing Organic, Yelp, Facebook, etc.) and the correct tracking number will display when a user reaches your website via one of those sources.

Use this article to learn how to:

  • Install CallRail's dynamic number insertion JavaScript code directly to your website.

How Dynamic Number Insertion Works

First, install CallRail’s swap code on your site. Each company in your CallRail account has its own, unique script for call tracking. The installation is just like installing Google Analytics— a single JavaScript snippet added to each page of your website before the </body> tag. This script tag works for both HTTP and HTTPS pages.

Then, create tracking numbers within your CallRail account to track visitors from a specific source, like Google AdWords. When a visitor navigates to your website through one of the sources you’re tracking, CallRail’s JavaScript will detect the phone numbers on your web page and swap them with the correct tracking number. We’ll then store the visitor’s source in a cookie so they’ll continue to see the same tracking number each time they return to your website (unless swap.js is removed).

There are several ways to install dynamic number insertion on your website. Here are our other help center articles that will guide you through installing dynamic number insertion using CallRail's WordPress plugin or Google Tag Manager:

Getting Started

There are a few important details you’ll need to know before you get started with dynamic number insertion:

  1. Once you’ve installed swap.js on your website, be sure to test your installation before your campaign begins.

    Learn how to test dynamic number insertion with this help article.

  2. Dynamic number insertion detects multiple number formats, including:
    111-222-3333, 111.222.3333, and (111) 222-3333.

  3. Special steps are necessary to swap phone numbers in images.

    Learn more about image swapping with this help article.

  4. CallRail’s swap.js code must be embedded on the visitor’s landing page, as well as each page on your website that displays a phone number. Ideally, swap.js should be installed on every page of your website.

Installing CallRail on Your Website

Each company in your account has its own unique JavaScript code for dynamic number insertion. If you have multiple companies in your CallRail account, you’ll have a different code for each.

  1. Choose the company whose JavaScript code you’d like to install.



  2. Click Settings at the top of the page.



  3. Select the Integrations tab, then click Dynamic Number Insertion.

    Integrations_DNI.png

  4. Copy the JavaScript provided. It should look similar to this sample JavaScript code.



  5. Paste it into each page of your website right before the </body> tag.

FAQs

Why isn’t my telephone number swapping?

Have you cleared your cookies, or tried accessing the website in a private browsing session? The most important part of testing dynamic number insertion is to simulate the experience of a first-time visitor before testing. Otherwise, the swap code will detect you as a visitor to the website from a previous session.

Learn more about testing dynamic number insertion with this article.

How do I prevent a number from swapping on my website?

If there is a specific place on your website where you don't want the number to swap, you're able to update the telephone number in your source code so that our swap script doesn't recognize it. In the number that you do not want to be swapped, you can use HTML tags that don't apply any additional style.

For example: 555-<span>444<span>-3333.

When setting this up, we recommend placing "<span>" within the middle of the phone number (as illustrated above). With those additional HTML tags, our JavaScript file will not find/swap the number that you'd like to appear static.

Can I use dynamic number insertion in an iframe?

We do not recommend installing our dynamic number insertion script in an iframe since they run independently from the rest of a website. This could cause an inconsistent experience for website visitors since they could potentially see two different tracking numbers on the same website. CallRail's swap script can still be installed on websites that use iframes, but any number within an iframe won't swap.

Can I use dynamic number insertion on my Squarespace site?

Yes. You can install CallRail's JavaScript code for dynamic number insertion on a Squarespace site using the Code Injection feature

Can I use dynamic number insertion on my Wix site?

It's currently not possible to install CallRail's JavaScript code for dynamic number insertion on a Wix site. Since Wix.com does not support the installation of JavaScript snippets like CallRail's, there's not a workaround at this time to use dynamic number insertion on a Wix site. 

Do I need to remove the JavaScript after I disable call tracking?

If you don’t plan on creating new tracking numbers in the same company where your tracking number(s) has been disabled, you can safely remove the CallRail JavaScript code. However, if you leave the swap script on your website, the numbers will no longer swap since those numbers have been disabled.

Can I have a white labeled version of my swap code?

Yes. Use the instructions above when logged into CallRail via your white label domain to access a white label version of your swap script.

Have more questions? Submit a request

Comments

Was this article helpful?