Click event tracking allows you to send custom events when a user clicks on a specific element on your website. This can be particularly useful for monitoring user interactions with elements like buttons, links, or other interactive components.

Usage

1

Enable Tracker

First, ensure that the click event tracking feature is enabled in your dashboard settings. Navigate to the “Tracker” section and check the box for “Click Events.”

It may take up to 6 hours for returning visitors to see the updated tracking code due to caching. Ensure your CDN respects our cache headers to prevent any unexpected delays.
2

Attach HTML Data Attributes

To track a click event, include the data-m:click HTML attribute on an element. This attribute should be a key-value pair that will be sent with the event.

The following example demonstrates how to attach custom properties to a click event:

<!DOCTYPE html>
<html>
	<body>
		<button data-m:click="action=purchase;product_id=123">Buy Now</button>
		<a href="/contact" data-m:click="action=contact">Contact Us</a>
	</body>
</html>

In this example, a click event with { "action": "purchase", "product_id": "123" } will be sent when the “Buy Now” button is clicked, and { "action": "contact" } will be sent when the “Contact Us” link is clicked.

You can set these attributes statically or dynamically based on user interactions or other relevant information.

Multiple properties can be separated by semi-colons.
3

View Events

Once the tracking code is updated on your website, you can view the custom properties in the event list on your dashboard. Each event will include the custom properties attached to the page view, allowing you to filter and segment your data based on these properties.