Jump to Table of Contents

Infinity Tracking JavaScript - JSON & Script Fallback

This article explains how the Infinity JavaScript execution works at a simple level, covering our use of JSON responses, and JavaScript responses as a fallback. It also covers the methods by which you can disable this fallback, ensuring that only JSON responses are used within your site.

How does tracking work when using the Infinity JavaScript library?

The snippet of code that you insert into your site serves two main purposes.

1) It configures a JavaScript object that details how tracking is setup for your site with Infinity, including things like the Installation ID, and any configured integrations.
2) It also holds code that loads the main Infinity Tracking library.

When the Infinity library is loaded, it executes, taking in the configuration of the object, and then performing tracking and number replacement. The Infinity library also makes available methods for various other aspects of client side operations such as: Custom Triggers, Callbacks, etc.

The Tracking requests that are performed always prefer to use XMLHttpRequest (XHR) with JSON responses from our tracking platform (known as Protocol Version 2).

However in some cases, where browser capability does not include the required features, or for Installations which are using our Classic JavaScript Config, our library will use other methods of tracking, including that of dropping a dynamic script tag into the page, which will then use a JavaScript response (known as Protocol Version 1).

Disabling Protocol Version 1

In some cases, you may not want our library to use the script tag method at all for tracking requests and responses, and we offer a way for you to easily configure this as part of the main Infinity config object.

When configuring the _ictt object (Before _track is called), you can use the _setMinimumProtocolVersion method, and set the minimum version to 2, this instructs our library (in cases where it needs to downgrade to Script tags) to instead perform no tracking.

It is important to note that using this approach will also limit functionality on older internet browsers such as Internet Explorer 6, 7 and 8.

This essentially impacts only browsers that do not support both XHR and JSON, which you can then use inline with your own browser support policy for the site(s) in question.

Method: _setMinimumProtocolVersion

Sets the minimum protocol version to be used for tracking and number allocation requests.

Protocol version 2 provides better security but is not compatible with older browsers, e.g. those which do not support JSON and XMLHttpRequest.

By default the Infinity JavaScript will fall back to protocol version 1 for any unsupported browsers, if you wish to prevent code from injecting JavaScript directly into the page, you can enforce a minimum protocol version of 2. Note that this will prevent tracking and phone number allocation in unsupported browsers.

This method cannot be used for Installations which are using our Classic JavaScript Config.

Example usage

_ictt.push(['_setMinimumProtocolVersion', 2]);

Optional Self Hosting of the Infinity JavaScript file

There are also other cases, whereby we allow clients to self host the JavaScript tracking file, this means that the configuration of the object is done in the same way but it is the responsibility of clients for loading the tracking library into the site.

Other responsibilities for clients using this method are adhering to Infinity's release and update process, this means clients will need to be prepared to update to any future JavaScript version releases so the self-hosted JavaScript library can be updated and is running the latest Infinity code.

As part of conversations you will have with our teams, we will discuss these approaches for self-hosting, and also the update policy in more detail.

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