Page event tracking allows you to include additional metadata about your users when they visit a specific page on your website. This feature is useful for segmenting users based on their state, such as whether they are logged in or which color theme they have selected.

Usage

1

Enable Tracker

First, ensure that the page event tracking feature is enabled in your dashboard settings. Navigate to the Tracker section and check the box for Page View Events.

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

Attach HTML Data Attributes

By including the data-m:load HTML attribute on any element on the page, you can automatically include additional metadata for each page visit. This attribute should be a key-value pair in the format key=value that will be sent with the event.

The following example demonstrates how to attach custom properties on page load:

<!DOCTYPE html>
<html>
	<body data-m:load="theme=dark;subscription=paid">
		<button data-m:load="logged_in=false">Log out</button>
		<h1>Welcome to My Page</h1>
	</body>
</html>

In this example, { "theme": "dark", "subscription": "paid", "logged_in": "true" } will be attached to the page load event. Multiple properties can be separated by semi-colons.

You can set these attributes statically or dynamically based on the user’s state or any 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.