Jump to Table of Contents

Adding Callbacks

Adding callbacks is a more advanced JavaScript function.

Adding Callbacks

You can register callbacks on the Infinity Javascript, any callbacks you register will be fired after tracking has taken place, and after number replacement has been performed.
By default, callbacks are called multiple times in certain cases.
If your callback function is not idempotent, then you can specify a maximum run count property, by passing an object param after the callback.

Example

To register a function named infinityCallback you would add one of the following before _track.

These are examples, actual functions would need defining to perform your required operations.

_ictt.push(['_addCallback', infinityMultiCallback]); // this callback could be called multiple times
_ictt.push(['_addCallback', infinitySingleCallback, {maxRunCount:1}]); // this callback will only be called once
_ictt.push(['_track']);

The infinityCallback function must be defined before you register it as a callback otherwise you will get JavaScript errors at runtime. You could alternatively use an anonymous function instead.

You can be sure that when the callback is fired, the Infinity visitor and number variables are available to you.

Please login to rate this article

Adding Callbacks

  1. Adding Callbacks

Related Articles

  1. Infinity JavaScript
  1. Getting Started
  2. Enhancing your Installation
  3. Frequently asked questions
  4. Call Management
  5. Number Management
  6. Infinity API