Click Tracking API

Click Tracking with the Webtrends Infinity Tag

There are several convenience functions exposed in the Webtrends Infinity Tag that are used for various forms of click tracking. Along with these convenience functions, there is an option to place the tag into a “manual mode” whereby it will not generate an initial seed message on load. This means that there will not be an automated page load message fired to the collection servers. If the tag is configured this way, you must use the functions below to pass data to the Webtrends collection servers.

WT.collect(params)

This is a manual collection event. This call allows you to construct custom track calls. The WT.collect call does not inherit any data apart from the visitor, visit, and sessionization information. You must also add the endpoint information as shown below. This call only applies to Infinity Analytics and can be ignored for Webtrends Optimize®.

  • Params {object}: Takes any object with a config and data object with key-value pairs.
    • Config: Configuration for specific call and supports the following:
      • Endpoints: Which URLs to send data to (If no protocolType is defined, then it defaults to gif).
      • Callbacks: These functions are called upon either the success or the failure of the attempted action.
    • Data: Any data keys/values to be added to the track.

    Note: The config, callbacks, and data options are optional in a WT.collect call.

The following are examples of callbacks:

function successCallback(args){
    console.log(args["endpoints"]);
    console.log(args["payload"]);
    console.log(args["timeout"]);
    console.log(args["success"]);
    console.log(args["failure"]);
};
function failCallback(args){
    console.log(args["endpoints"]);
    console.log(args["payload"]);
    console.log(args["timeout"]);
    console.log(args["success"]);
    console.log(args["failure"]);
};
WT.collect({
    "config": {
        "endpoints": [
            {
                "endpoint": "http://statse.webtrendslive.com/dcs000seu93u4bk4z5bht3q6v_5q9p/dcs.gif",
                "protocolType": "gif"
            }
        ],
        "callbacks":{
            "success":successCallback,
            "fail":failCallback
        }
    },
    "data":{
      "testKey":"testValue"
    }
})

WT.view(params)

This is used to refer to a viewing of a particular presentation, or wrapper, around a collect call. The default set of data is added to this call on views with WT.dl=0.

Values placed in the data object are added to the data normally sent on the collect call during pageAnalyze. To alter or update the data normally being sent the mutations api should be used. This call is not necessary to track Webtrends Optimize data as those values are automatically passed along with any Analytics data collected. If this is desired, then use WT.Execute to re-run the Webtrends Optimize experiment.

  • Params {object}: Takes any object with a config and data object with key-value pairs as below:
    • Config: Configuration for specific call and supports the following:
      • Endpoints: Which URLs to send data to (If no protocolType is defined, then it defaults to gif).
      • Callbacks: These functions are called upon either the success or the failure of the attempted action.
    • Data: Any data keys/values to be added to the track. Any of the same fields found via pageAnalysis will be overriden by key/values placed here

    Note: The config, endpoints, callbacks, and data options are optional in a WT.view call.

The following is an example of callback formatting:

WT.view({
    "config": {
        "endpoints": [
            {
                "endpoint": "http://another.endpoint/dcs000seu93u4bk4z5bht3q6v_5q9p/dcs.gif",
                "protocolType": "gif"
            }
        ],
        "callbacks":{
            "success":successCallback,
            "fail":failCallback
        }
    },
    "data":{
      "testKey":"testValue"
    }
})

WT.click(params)

These are used to interact with click activity. This contains all analytics data sent on the view request, except where overridden in the params object as defined below. This only alters the data on that specific request rather than on all subsequent requests (i.e., clicks changes to data are self contained). To do an Webtrends Optimize conversion, include the testAlias and:

  • Params {object}: Takes any object with a config and data object with key-value pairs as below:
    • Config: Configuration for specific call and supports the following:
      • Endpoints: Which URLs to send data to (If no protocolType is defined, then it defaults to gif).
      • Callbacks: These functions are called upon either the success or the failure of the attempted action.
      • Mutation: Optionally, run page analysis by configuring mutation section to contain runAnalysis attribute.
      • testAlias(required for conversions): testAlias associated with the conversionPoint.
      • ConversionPoint (required for conversions): Name of the conversionPoint.
    • Data: Any data keys/values to be added to the track. Any of the same fields found via pageAnalysis are overriden by key/values placed here.

    Note: The config, endpoints, callbacks, mutation, and data options are optional in a WT.click call.

Example:

WT.click({
    "config": {
        "endpoints": [
            {
                "endpoint": "http://another.endpoint/dcs000seu93u4bk4z5bht3q6v_5q9p/dcs.gif",
                "protocolType": "gif" 
            }
        ],
        "mutation" : { 
            "runAnalysis" : true
        },
        "callbacks":{
            "success":successCallback,
            "fail":failCallback
        },
        "testAlias":"ta_myTest",
        "conversionPoint":"my_conversionPointName"
    },
    "data":{
      "testKey":"testValue"
    }
})