Logo

How can we help?

Troubleshooting Common Dynamic Number Insertion (DNI) Issues

If you have tested the number swapping on your website and found that it is not working, there are several common reasons why this might be happening. This article guides you through troubleshooting these issues to help determine what the problem might be. 

 

Section Links

Each section addresses a different common issue. For your convenience, the items below are listed from the most common reason to the least common

Script not running correctly or is not installed correctly

Phone number to "replace" on the website was not found

All source conditions to trigger a number swap are not met

A conflicting call tracking script is replacing the NinjaTrack number

The tracking script ran too early before the web page fully loaded

Other scripts on the website have javascript errors that are interfering

 

Script not running correctly or is not installed correctly

The following steps will walk you through the process using a Chrome web browser to check if the script is installed correctly.

1. Visit the website where the script is installed

2. Click on the three dots in the top-right corner of Chrome and select More Tools - Developer Tools

3. Click on the "Sources" tab in the developer tools window.

mceclip0.png

 

4. If the NinjaTrack script is installed correctly on the website, you will see the web domain scripts.mymarketingreports.com running under the sources tab.  If you do not see this domain listed here, then there may be an issue with installing the NinjaTrack script.  Common issues with installation of the script might be:

  • The script tag was placed in an incorrect location on the website. It should be placed immediately before the closing </body> tag of all pages on the website.
  • The script tag was copied or pasted from a program that introduced links or incorrect quotes or foreign characters that should not be there.  
  • If using Google Tag Manager, the NinjaTrack script tag was not published correctly

 

Phone number to replace on the website was not found

The NinjaTrack script works by searching the website for the string of numbers of the destination number. If the destination number is found, then the script will replace it with the tracking number.  If the destination number is not on the website, then the script will not know where to place the tracking number.  Here are some tips on how to correct this issue:

1.  If the phone number on the website has changed causing the NinjaTrack script to break, then updating the destination number in your NinjaTrack settings to the number that shows on the website should correct the swapping issues.

2.  If the phone number on the website is different from the destination number called by NinjaTrack, then the website phone number can be added under the "Alternate Numbers to Replace" settings in NinjaTrack.

mceclip0.png

 

3.  Sometimes the phone number on the website is coded in such a way that there are extra tags in the middle of the numbers that interfere with the script's ability to find the phone number.  This might be done to create a specific visual effect on the phone number using different font colors or styles.  In cases such as this, the "alternate numbers to replace" box can be used to enter in the code of the website exactly as it appears, so that we can replace the phone number.  A second option would be to simplify the phone number on the website to remove extra tags or formatting that is interfering with the script number replacement.

 

All source conditions to trigger a number swap are not met

The NinjaTrack dynamic number insertion script is designed to only replace the phone numbers on your website when specific conditions are met, and sometimes there are multiple conditions that must all be true.  For example, if the tracking number is set up to track google paid traffic with a required URL parameter, then in order for the number to swap, BOTH conditions must be met - the visitor must come from a google paid website AND the landing page URL must have the required parameter present in order to trigger a number swap.

To check the source requirements for your NinjaTrack number, start by editing the NinjaTrack number and expand out the "TRACKING SOURCES" tab of your number settings:

mceclip0.png

 In order for number swapping to occur, all of the following conditions must be met:

  • The user does not already have a NinjaTrack Cookie stored in their web browser from a previous visit
  • The website visitor is confirmed to have originated from the tracking source of the phone number.  Review the documentation on source-tracking requirements for more information.
  • All required URL parameters are included after the question mark in the landing page URL
  • No restricted URL parameters are included after the question mark in the landing page URL

 

A conflicting call tracking script is replacing the NinjaTrack number

When using NinjaTrack as your call tracking solution, it is recommended that all other call tracking scripts be removed from the website in order to avoid any number-swapping conflicts. However, if it is necessary for other scripts to be used with NinjaTrack, here are some tips on how you can get the call tracking scripts to play nicely with NinjaTrack:

1. Always place the NinjaTrack script immediately before the closing </body> tag so that it is the last script that executes on the page. This will help to ensure that the NinjaTrack number will not be changed after the script has completed.

2. If the destination number of the NinjaTrack number has already been replaced by a call tracking number from another provider, you can place that phone number in the "alternate numbers to replace" box in your number settings so that when the NinjaTrack script runs, it will replace the other call tracking numbers as well.

 

The tracking script ran too early before the web page fully loaded

 If the web page is loading the website dynamically, or if the NinjaTrack script was not placed prior to the closing </body> tag, then it is possible that the NinjaTrack script is firing before all of the phone numbers on the website have appeared. 

What can sometimes happen in this case is that the NinjaTrack script will run before the phone number it needs to replace is visible on the screen. Once the website has finished loading, the NinjaTrack script has already completed and so the number swap does not happen.

In the case where this is caused by a website that is loading dynamically, a delay may be placed prior to the NinjaTrack script to cause it to load at the very end. Alternatively, the NinjaTrack script may be placed in a loop so that it will continue to execute until a phone number has been swapped on the page. Here's an example of how to do this:

<script>
document.addEventListener("nt_done", checkReplacement);function checkReplacement(){
if (jQuery('[ninjatrack_orig]').length == 0)
window.setTimeout('retryReplacement()', 250);
}function retryReplacement(){
doneSent = false;
getReplacementNumber();
}
</script>

 

Other scripts on the website have javascript errors that are interfering

If the NinjaTrack script tag is loading in the body of the web page after a competing script above it has errors, then the NinjaTrack script may not execute correctly because of the javascript errors.

To check whether or not there are javascript errors on the website, click on the three dots in the top-right corner of Chrome, then select More Tools -> Developer tools.  Navigate to the "Console" tab:

mceclip0.png

Review all errors that appear in red on this screen to determine if there could potentially be a script that is preventing the NinjaTrack call tracking script from executing correctly.

Was this article helpful?
0 out of 0 found this helpful
Have more questions? Submit a request