Skip to content Skip to sidebar Skip to footer

Omniture Sitecatlayst Tracking: Error When Calling S.tl() From Within A Function With Jquery Without Binding To Click Event

I want to track when a user submits a form using Omniture's 'Custom Link Tracking'. This feature utilizes the built-in function s.tl(). A typical setup looks like this: $('a#submit

Solution 1:

The first parameter for s.tl can only have one of two values.

If the function is being called as the onclick handler for an element, then it takes the value - this -, which in this case resolves to the value of the href attribute of the element. If this is passed as the first parameter, then the function will create a 500ms delay before the new page is loaded, this is to ensure there is enough time for the tracking call to be sent.

If the function is being called in any other context, including as part of a form or ajax success handler, then the first parameter has to be a literal - true -. In this case, the function doesn't add the delay, but will still send the tracking call.

In your case the correct signature is this:

s.tl(true, 'o', 'Form Submitted');

Solution 2:

Try:

$.ajax({
    type: 'POST',
    url: submit.php,
    data: [data],
    success: trackLink.bind(this)
});

Solution 3:

You could also try switching around the function setup.

function trackLink() {
    s=s_gi(s_account);
    s.trackExternalLinks = false;
    s.linkTrackVars = 'events,prop1';
    s.linkTrackEvents = s.events = 'event1';
    s.prop1 = s.pageName;
    s.tl(this, 'o', 'Form Submitted');
}

Post a Comment for "Omniture Sitecatlayst Tracking: Error When Calling S.tl() From Within A Function With Jquery Without Binding To Click Event"