views:

72

answers:

3

In my app a user clicks a link to another page. I'd like to track that in Omniture with a custom event, so I've bound the omniture s.t() event to the click event. How can I make certain the event fires before the next page is requested?

I've considered event.preventDefault() on the click event of the link, but I actually want the original event to occur, just not immediately.

+1  A: 

Some thing like this:

var cachedEvent = yourElement.onclick;
yourElement.onclick = function(){

    s.t(); // Omniture thingy
    cachedEvent(); // Old event

}
Vincent
A: 

I don't know what Omniture events are, but just have

yourElement.onClick = function(){
    omnitureFunction();
}

onmitureFunction = function() {
    //stuff
    myOtherFunction();//what onClick is "supposed to do"
}

So function2 happens only on successful completion of function1

Alex Mcp
+1  A: 

omniture's s.tl() function has a built-in delay

Crayon Violent
Yep. Apparently the function needed a reference link or "true" to be passed, which is what I was missing.
Mike Robinson