How to Install Javascript on Your Website


If you’re interested in knowing which specific keywords and marketing channels are driving calls to your business, JavaScript is your new best friend.

Installing a JavaScript snippet on your website allows you to reap the benefits of dynamic number insertion and keyword level call tracking - a deeper dive into what actually drives conversions from you website to your business. Before we get into how to install JavaScript let’s define why each of these features are important to your call tracking campaigns.

  • JavaScript Snippet: JavaScript is a programming language commonly used to create interactive effects within web browsers (cool effects like swapping numbers and images). CallRail’s JavaScript snippet detects the phone number you already have on your web page and swaps it with the correct tracking number.

  • Dynamic Number Insertion: Dynamic number insertion allows you to swap phone numbers dynamically, depending on the source of traffic to your website. For example, 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.

  • Keyword Level Call Tracking: Keyword level call tracking is one of our most used and powerful features. When a visitor comes to your website following an online search, we assign a unique phone number to them during their entire stay (using dynamic number insertion brought to you by way of the JavaScript snippet you installed - see how it’s all connected?). This way, you can not only see which marketing sources are driving calls, but you can drill down to the individual search keyword level for ads and view the connection between specific web visitors and their actions on your site.

See, it all works together to make your website a lean, mean, call tracking machine. It’s worth noting that you can use CallRail’s easy-to-install plugin to quickly install dynamic number insertion if you’re using a WordPress site. You can find the step by step tutorial on using our plugin, here.

Though the task of going into your website’s HTML can seem daunting, installing this snippet is simple and not the least bit scary. Here’s how:

Install JavaScript on Your Site

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.

First, choose the company whose JavaScript code you’d like to install.

Then, click Settings at the top of the page.

Select the Integrations tab, then click Dynamic Number Insertion.

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

Paste it into each page of your website right before the tag.

This is one of several ways to install and use 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:

Want to learn more about installing Javascript on your CallRail site? Visit our Dynamic Number Insertion overview, here.