This article provides information around our Infinity JavaScript and how it should be implemented.
Our JavaScript is unobtrusive and won't effect any other script on your page. This JavaScript DOES NOT replace your Google, Bing or any other tracking, this should be left in place.
Our JavaScript needs to be placed just before the closing tag element within each page of the website as this will allow for the fastest execution. This is a lightweight, asynchronous code base of around 3kb and will not block the rest of the site from loading.
Placing our JavaScript at the bottom of the page can effect the way our tracking captures certain criteria for example the CID for Google Analytics. It can also delay number replacement.
Infinity has two detection methods available to target numbers on the website.
Option 1 - HTML Class Targeting (Developer Required)
This would require a developer to update the HTML of the website to add a new class called InfinityNumber wherever a telephone number appears on the website.
<span class="InfinityNumber">01234 567890</span>
This approach allows the client to tell our JavaScript exactly where on the page a telephone number appears for speed efficiency so the number can be dynamically replaced with an Infinity tracking number.
If your phone numbers use href or tel: links please ensure these come after the InfinityNumber class so that the href / tel: is also replaced with a dynamic telephone number.
Option 2 - Classless Targeting (No Developer required)
If development resources are limited or backlogged and the InfinityNumber class can not be added directly to the HTML then an alternative method called ‘Classless’ can be used.
The code will target the contents of elements and anything that looks like a telephone number so will scrape the page and then dynamically replace it with an Infinity tracking number.
Note: Although this code will capture anything that looks like a telephone number, please be assured that unless the found number matches a Tracking Pool in the Infinity database then the number will not be replaced with a dynamic telephone number. This approach is also useful if only tracking on certain stores or locations initially.
Below is an example of the classless Infinity JavaScript which can be deployed entirely through a tag manager and requires no development resources to get up and running.
This will ensure a quick and smooth onboarding process for the client to capture every location that a telephone number may appear on the website.
The phone number(s) that are found are then looked up against the configuration of your tracking pool(s) to see which one to use. You configure the tracking pool(s) Auto Discovery numbers on the JavaScript Config page of the Portal.
Once the Tracking Pool(s) to use has/have been discovered, a dynamic number is assigned for each one, and the dynamic number replaces the contents of the element in question.
IMPORTANT: You will need to update the line _ictt.push(['_setIgrp','XXXX']); to contain your 4 digit IGRP ID that can be obtained from within the Hub
<!--
<!-- Infinity Tracking Code v2.0
Copyright Infinity 2020
www.infinity.co -->
<script type="text/javascript">
var _ictt = _ictt || [];
_ictt.push(['_setIgrp','XXXX']);
_ictt.push(['_enableGAIntegration',{'gua':true,'ga':false}]);
_ictt.push(['_enableClasslessReplacements']);
_ictt.push(['_track']);
(function() {
var ict = document.createElement('script'); ict.type = 'text/javascript'; ict.async = true;
ict.src = ('https:' == document.location.protocol ? 'https://' : 'http://') +
'ict.infinity-tracking.net/js/nas.v1.min.js';
var scr = document.getElementsByTagName('script')[0]; scr.parentNode.insertBefore(ict, scr);
})();
</script>
<!-- Infinity Tracking Code End -->
Please note that the main difference from this version of the code to the AutoDiscover code snippet is the line _enableClasslessReplacements instead of the _enableAutoDiscovery line in the other version. You should only be using one.
_ictt.push(['_enableClasslessReplacements']);
Our Auto Discovery code looks for phone numbers in your site that are wrapped in an element, and have the InfinityNumber class on them. Please see example below:
<span class="InfinityNumber">01234 567890</span>
The phone number(s) that are found are then looked up against the configuration of your tracking pool(s) to see which one to use. You configure the tracking pool(s) Auto Discovery numbers on the JavaScript Config page of the Portal.
Once the Tracking Pool(s) to use has/have been discovered, a dynamic number is assigned for each one, and the dynamic number replaces the contents of the element in question.
The below is an example of the Auto Discovery code which will go into the <head>
of your website :
<!--
This is demonstration code only. Do not use in production.
Please use the code generator in the Infinity Portal at:
https://portal.infinity-tracking.com/admin/config/javascript
-->
<!-- Infinity Tracking Code v2.0
Copyright Infinity 2015
www.infinitycloud.com -->
<script type="text/javascript">
var _ictt = _ictt || [];
_ictt.push(['_setIgrp','XXX']); // Installation ID
_ictt.push(['_enableGAIntegration',{'gua':true,'ga':false}]);
_ictt.push(['_enableAutoDiscovery']);
_ictt.push(['_track']);
(function() {
var ict = document.createElement('script'); ict.type = 'text/javascript'; ict.async = true;
ict.src = ('https:' == document.location.protocol ? 'https://' : 'http://') + 'ict.infinity-tracking.net/js/nas.v1.min.js';
var scr = document.getElementsByTagName('script')[0]; scr.parentNode.insertBefore(ict, scr);
})();
</script>
<!-- Infinity Tracking Code End -->
</head>
Our Classic code is not being used by clients who came on board after June 2015. The Classic code uses arrays set in the _setDgrp
line of the tracking code to search the page for the same array within an Infinity span class in order to perform number replacement. This span class is added in place of all existing numbers that you would like replaced with Infinity tracking numbers in the page, please see example of an Infinity span class and matching Classic code array below:
Array in body of tracking code:
_ictt.push(['_setDgrp', ['y', Array('TrackingNumber')]]);
Matching Infinity span class:
<span class="TrackingNumber">0800 123 0001</span>
The number within the Infinity span class is provided to you by Infinity and is called a 'Fall back Number'.
You may have multiple Tracking Pools which would require you to have more than one array and matching span class, you should only use the arrays and span classes you would like displayed on each page to improve accuracy of reporting.
The below is an example of the Classic code would go into the <head>
of your website
<!-- Infinity Tracking Code v1.30
Copyright Infinity Tracking 2011
www.Infinity-Tracking.com -->
<script type="text/javascript">
var _ictt = _ictt || [];
_ictt.push(['_setIgrp', 'x']); // Installation ID
_ictt.push(['_setDgrp', ['y', Array('TrackingNumber')]]);
_ictt.push(['_track']);
(function() {
var ict = document.createElement('script'); ict.type = 'text/javascript'; ict.async = true;
ict.src = ('https:' == document.location.protocol ? 'https://' : 'http://') + 'assets.infinity-tracking.net/nas/js/nas.v1.min.js';
var scr = document.getElementsByTagName('script')[0]; scr.parentNode.insertBefore(ict, scr);
})();
</script>
<!-- Infinity Tracking Code End -->
Please login to rate this article