Installing
Installation
Add the Mezura tracker to your website to start running conversion experiments. It’s a small script you paste once, plus a configuration object that tells Mezura about the current page.
Step-by-step
-
1
Copy the snippet below and replace
{workspace_token}with your workspace token (find it in your workspace settings). -
2
Paste it just before the closing
</head>tag on every page you want to track. -
3
Set
data.page_typeto describe the current page — this is how Mezura decides which experiments run where. -
4
Optionally set
data.user_idto attribute conversions to a known user. -
5
Publish your site. Data starts flowing to your Mezura dashboard within a few minutes.
The snippet
Put your configuration inside window.$mezura.data, then load the tracker. When the tracker loads it reads $mezura.data and sends this information to Mezura. Keeping your data under data keeps it separate from the methods the tracker adds to $mezura (like send_event).
<script>
window.$mezura = {
data: {
workspace_token: "{workspace_token}",
page_type: "ProductListing",
user_id: 1
}
};
</script>
<script async src="https://mezura.test/track.js"></script>
Parameters
| Field | Type | Required | Description |
|---|---|---|---|
| page_type | string | Required | Identifies the kind of page. Mezura uses it to decide which experiments run on which pages. |
| user_id | number | Optional | Your own identifier for a logged-in user, used for conversion tracking. If you omit it, Mezura tracks visitors by an anonymous browser id instead. |
| debug | boolean | Optional | Set to true while testing to log tracker activity to the browser console and keep this traffic out of your real results. Only takes effect when debug mode is also enabled for the workspace, so leaving it on by accident is harmless. |
Choosing a page_type
Use a short, descriptive name for each distinct kind of page. Common examples:
These are just examples — you can define your own page types that match your site. Use the same value consistently across pages of the same kind so experiments target them correctly.
Verify your installation
To confirm the tracker is working:
-
Open your browser’s developer tools, go to the Network tab, and reload the page. You should see a request to
track.jsand a request to/api/track. - Within a few minutes, your page appears in the Mezura dashboard and starts collecting data.
<head>, the workspace_token is correct, and page_type is set.