For the complete documentation index, see llms.txt. This page is also available as Markdown.

Email tracking

Track email opens with a pixel and clicks with a tracking URL.

Your goal

Record that a user opened one of your emails, and that they clicked a link inside it, so those interactions appear on their timeline alongside everything else.

Expected outcome

$email_view and $email_click events arriving with the user identified - ideally by an email hash you supply rather than by a cookie you hope is readable.

How it works

There is a distinct mechanism per action:

To track
You must

The opening of an email

Include a pixel.

The clicks on links in the email

Replace each link with a click tracking URL.

For each event, the datamart identifies the user:

  • Recommended: by the user's email hash, which you include in the pixel or tracking URL.

  • Otherwise by reading their cookies, which works reliably for clicks but only sometimes for opens, depending on the email client.

Activities tracked this way have $type set to EMAIL and $session_status set to NO_SESSION. See the UserActivity object.

Tracking opens with a pixel

Calls to this URL generate events:

Using the $uids field instead of a single identifier:

With a custom domain:

Tracking clicks

Calls to this URL generate click events and redirect the user:

Parameters

The same parameters apply to both URLs, apart from $redirect, which is specific to clicks.

Field
Type
Description

$ev

String

The event name: $email_view for opens, $email_click for clicks.

$dat_token

String

The token of the audience datamart.

$redirect

String

Clicks only. The redirect URL, URL-encoded, placed last.

$cuid

String, optional

The user account ID.

$email

String, optional

The user's email.

$email_hash

String, optional

The user's email hash.

$cb

String, optional

The cache buster - a random string.

$uids

JSON as string, optional

The list of user identifiers.

any custom property

Any

A custom property.

Include $cb with a random value on pixels. Without a cache buster, an email client that caches images can prevent the open from being recorded.

Consistency with the rest of your data

The email hash you put in these URLs is the same identifier used everywhere else, so it must use the same hash function as the rest of your datamart - otherwise email interactions land on a different UserPoint from the rest of the user's history. See UserEmail.

Verify

  • $email_view and $email_click events appear on the timeline of a test user.

  • The activities carry $type EMAIL.

  • Clicks redirect to the intended destination, with the parameters after $redirect - if any - knowingly discarded.

  • Interactions land on the same UserPoint as the user's site activity, which confirms the hash matches.

Last updated

Was this helpful?