Tracking Transforms

Transforms are functions that take as arguments a reference to the DCS object and the tracking object. They are used to modify the data collected or to change the behavior of the tracking code. In either case, they are called just before the beacon request is generated.

Transforms allow you to modify the Tag and/or Multitrack object just before the beacon request is created. Transforms come in two flavors: inline and global. The global transform applies to all Multitrack calls, where as the inline version only applies to the a single Multitrack call. You can have zero to many global transforms per page, where as inline transforms are zero or one per multitrack call.

Webtrends.addTransform(Function, Event, dcsObject)
Function
The function to execute when the event occurs. This function accepts two arguments (dcsObject and Multitrack object).
Event
A string with one of these 3 values; "all", "multitrack" or "collect".   A value of "all" means the transform should be called on all tracking events. A value of "multitrack" means the transform should only be called during a multitrack event. A value of "collect" means the transform should only be called during the first track function call.
dcsObject (optional)
By default, transforms are applied to all instances of the Webtrends.dcs object. You may specify an instance of the Webtrends.dcs object, which will constrain the transform to just that Webtrends.dcs object.

JavaScript Example:

window.webtrendsAsyncInit = function () 
{
 	var dcs = new Webtrends.dcs();
	dcs.init( {
		dcsid:    "dcs9x99xxxx9xxx9xx9xxxx9x_9x9x",
		timezone: -7
	});
	
	Webtrends.addTransform( 
		function(dcsObject, multiTrackObject) { 
                        multiTrackObject.argsa.push(
                                "DCSext.custom01", "foo",
				"DCSext.custom02", "HW"
                        )	
 			console.log("Transform1: std keys added!"); 
		},
		"all", dcs
	);
	
	dcs.track();
};