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 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.

Support article

Was this article helpful?

Thank you! Your feedback is important to us.

Your feedback is greatly appreciated!

Support helper

Need more help?

Contact Support

Your message has been sent! Send another message.

We're standing by to give you a hand.