Install CallRail with Google Tag Manager

CallRail's JavaScript snippet makes it possible to swap tracking numbers on your website using dynamic number insertion. Google Tag Manager is an easy way to manage all HTML/JavaScript snippets and tags on your website. Using Google Tag Manager, you can quickly add the JavaScript snippet to enable dynamic number insertion on your website.

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 the JavaScript snippet on your website, be sure to test your installation before your campaign begins.

  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.

  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 with Google Tag Manager

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. Click the Settings icon on the left navigation bar.

  2. Choose the company where you'd like to activate Google Tag Manager.

  3. Click Integrations at the top of the page.

  4. Choose Google Tag Manager from the list of integrations.

  5. Open a separate browser tab and log into your Google Tag Manager account. Then navigate to the domain where the installation takes place.

  6. Click Add a New Tag.

  7. Name the tag at the top of the page, then select the box labeled Tag Configuration.

  8. Select Custom HTML under the section Custom.

  9. Copy the code snippet from the Google Tag Manager page within CallRail to the HTML box in Google Tag Manager.

  10. Select the Triggering box, and choose your trigger. We recommend setting your script to fire on all pages of your website by selecting the + at the top of the page, then clicking Page ViewAll Page Views.

  11. Click Save to add your tag to your workspace.

  12. Once your tag has been added to your workspace according to these instructions, click Publish at the top of the page to activate the script on your website.


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 help article.

Do I need to remove the JavaScript after I deactivate call tracking?
CallRail’s JavaScript code is company-specific. If you don’t plan on creating new tracking numbers in the same company where your tracking number(s) has been deactivated, 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 deactivated.

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.

Can I install Callrail on my Shopify Website?
In most cases, you can install the CallRail JavaScript code on a Shopify website using Google Tag Manager. However, Google Tag Manager is only available only to customers on the on the Shopify Plus plan.

Was this article helpful?
4 out of 5 found this helpful

Articles in this section

See more
Ask the Community
Find best practices, post, and learn from CallRail users.
CallRail Support Hours
Weekdays 9:00am - 9:00pm EST