> For the complete documentation index, see [llms.txt](https://developer.mediarithmics.io/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://developer.mediarithmics.io/data-ingestion/real-time-user-tracking/email-views-and-clicks.md).

# Email views and clicks

You can track **read** and **click** actions in emails sent to your customers.

* To track the **opening** of the emails, you have to **include a pixel**
* To track the **clicks** on the links included in your emails, you have to r**eplace each of your links with a Click Tracking URL**

For each event, the datamart will **identify the users** reading/clicking the email by:

* **Recommended option:** using the user's Email Hash, included by you in the pixel/tracking URL
* Reading their cookies if possible:
  * It is always working when the users are clicking (e.g. Click Tracking URL)
  * It is sometimes possible when the users are opening the emails, depending on their email client (e.g. Pixel)

{% hint style="info" %}
Activities tracked through this method will be of `EMAIL` *$type* and `NO_SESSION` *$session\_status*. See [UserActivity object](/user-points/user-activities.md#user-activity-object) for more information.
{% endhint %}

## Pixel Touch for Email Opening

Calls to those URLs generate [events](/user-points/user-activities.md#user-events-object).

```markup
https://events.mediarithmics.com/v1/touches/pixel?  
  $ev=$email_view&  
  $dat_token=<DATAMART_TOKEN>&  
  $email_hash=78b04074e616166938cf672f70f41b4d&  
  Any Custom Properties ...
```

or if your are using the `$uids` field (see [Passing user identifiers in pixel-based tracking](/data-ingestion/real-time-user-tracking/ads-exposure.md#passing-user-identifiers-in-pixel-based-tracking)) &#x20;

```
https://events.mediarithmics.com/v1/touches/pixel?  
  $ev=$email_view&  
  $dat_token=<DATAMART_TOKEN>&  
  $uids=jso-[{"$tpe":"EM","$eh":"78b04074e616166938cf672f70f41b4d"}]&
  Any Custom Properties ...
```

or if you are using a custom domain:

```markup
https://analytics.custom-domain.com/v1/touches/pixel? 
    $ev=$email_view& 
    $dat_token=<DATAMART_TOKEN>& 
    $email_hash=78b04074e616166938cf672f70f41b4d& 
    Any Custom Properties ...
```

It is possible to set custom properties

| Field                    | Type                      | Description                                                                                                                                           |
| ------------------------ | ------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------- |
| $ev                      | String                    | The event name. **$email\_view for email opening tracking**                                                                                           |
| $dat\_token              | String                    | The id of the audience datamart in the mediarithmics platform.                                                                                        |
| $cuid                    | String (Optional)         | The user account id.                                                                                                                                  |
| $email                   | String (Optional)         | The user email.                                                                                                                                       |
| $email\_hash             | String (Optional)         | The user email hash.                                                                                                                                  |
| $cb                      | String (Optional)         | The cache buster parameter. It should contain a random string.                                                                                        |
| $uids                    | JSON as string (Optional) | The list of [user identifiers](/data-ingestion/real-time-user-tracking/ads-exposure.md#passing-user-identifiers-in-pixel-based-tracking) of the user. |
| any custom property name | Any Type                  | Any custom property                                                                                                                                   |

## Click Tracking for Emails&#x20;

Calls to those URLs generate click [events](/user-points/user-activities.md#user-events-object)

```markup
https://events.mediarithmics.com/v1/touches/click?
    $ev=$email_click&
    $dat_token=<DATAMART_TOKEN>&
    $email_hash=78b04074e616166938cf672f70f41b4d&
    Any Custom Properties &
    $redirect=<CLICK_URL>
```

\
It is also possible to set custom properties.

\
The $redirect parameter is used to define the destination of the url redirection. The URL put in the $redirect parameter should be [URL Encoded (RFC 3986)](https://en.wikipedia.org/wiki/Percent-encoding).

| Field                    | Type                      | Description                                                                                                                                                                                                             |
| ------------------------ | ------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| $ev                      | String                    | The event name. **$email\_click for email opening tracking**                                                                                                                                                            |
| $dat\_token              | String                    | The id of the audience datamart in the mediarithmics platform.                                                                                                                                                          |
| $redirect                | String                    | The redirect url. This string should url encoded. (RFC 3986). **Warning**: this parameters must be placed at the end of the URL. *Any parameters that will be placed after the $redirect parameters will not be saved.* |
| $cuid                    | String (Optional)         | The user account id.                                                                                                                                                                                                    |
| $email                   | String (Optional)         | The user email.                                                                                                                                                                                                         |
| $email\_hash             | String (Optional)         | The user email hash.                                                                                                                                                                                                    |
| $cb                      | String (Optional)         | The cache buster parameter. It should contain a random string.                                                                                                                                                          |
| $uids                    | JSON as string (Optional) | The list of [user identifiers](/data-ingestion/real-time-user-tracking/ads-exposure.md#passing-user-identifiers-in-pixel-based-tracking) of the user.                                                                   |
| any custom property name | Any Type (Optional)       | Any custom property.                                                                                                                                                                                                    |


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://developer.mediarithmics.io/data-ingestion/real-time-user-tracking/email-views-and-clicks.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
