Adobe Analytics PreTrack & PostTrack

Like to do some additional cool stuff for your company by utilizing adobe analytics image request and appending additional data  (PII or non PII)  by sending to in house infrastructure? thanks to Adobe analytics JavaScript 1.8.0  version.

The following pre- and post-tracking call hooks.

s.registerPreTrackCallback

s.registerPostTrackCallback

These functions take as parameters: the callback (a function), and the parameters to that function.  The callback is invoked with the requestUrl and any parameters passed in when the callback is registered. This occurs either before or after the tracking call, depending on which method is used to register the callback. The order in which these callbacks are called is not guaranteed. Callbacks registered in the pre function are invoked after the final tracking URL is created. The post callbacks are called upon a successful tracking call (if the tracking call fails, these functions are not called).

Place the hook function simply in doPlugins section

s.usePlugins=true
function s_doPlugins(s) {s.registerPreTrackCallback(function(requestUrl) {
// requestUrl is  current Image Request URL
var str = requestUrl;
var nstr = str.replace(“currenttrackingdomain.com”, ‘inhousetrackingdomain.com’);
var xhttp = new XMLHttpRequest();
xhttp.open(“POST”, nstr , true);
xhttp.send();
});}
s.doPlugins=s_doPlugins

Any callback registered with registerPreTrackCallback do not affect the tracking call.

Also, calling any of the tracking methods in any registered callback is not recommended by Adobe and could cause an infinite loop.

 

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s