Jump to Table of Contents

Infinity JavaScript

This article provides information around our Infinity JavaScript and how it should be implemented.

Asynchronous Infinity JavaScript

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.

What is Auto Discovery?

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>

What is Classic?

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
  1. Getting Started
  2. Enhancing your Installation
  3. Frequently asked questions
  4. Call Management
  5. Number Management
  6. Infinity API