Tracking Custom Elements with an ID Attribute
Sometimes you want an element to be identified based on its position relative to other elements rather than its content. For example, you might have three rotating or randomized images on a page that you want to identify in your reports based on which of the three was clicked rather than based on the image URL. You can use the ceid attribute to track in this manner.
Using the data-ceid attribute
The data-ceid attribute forces Crazy Egg to identify an element using whatever you provided as the attribute value rather than the element’s content.
Here’s an example:
<img src=”image_23894723.jpg” data-ceid=”random_image_1″ />
<img src=”image_38947234.jpg” data-ceid=”random_image_2″ />
<img src=”image_09834343.jpg” data-ceid=”random_image_3″ />
No matter what the value of the src attribute is for the first image, it will always be identified as random_image_1. The same goes for the second and third images; regardless of what their src is, they will always be identified as random_image_2 and random_image_3, respectively.
This approach works just as well with any other element type as it does with images. Use the ceid attribute whenever you need to override Crazy Egg’s default element identification procedure.