Custom Tracking: CE2 Functions

The Crazy Egg tracking script provides a few utility functions that you can employ to help you implement custom tracking behaviors.

CE2.getBox(element)
element: A DOM element
Returns an object describing the size and absolute position of the element. Example:
{left: 353, top: 1114, width: 426, height: 36}     
CE2.listen(target, event, function)
target: A DOM element
event: Name of the event to listen for, e.g. “click”, “keyup”, “load”, etc.
function: The function to call when the event occurs

This is a very simple method of registering event handlers. Unlike a full-featured JavaScript framework, this function passes only native event objects to the hander. Do not expect your event handlers to receive wrapped, normalized event objects. Use a full-featured JavaScript framework if you require that feature. This function should suffice, however, if all you want to do is pass the event object to CE2.click.

Still need help? Contact Us Contact Us