Leading Consent Management Platform

Compliant with GDPR, CCPA, COPPA, LGPD, PECR, PDPA, PIPEDA, and more.

Email Open Tracking Consent

Tracking whether recipients open your emails (tracking pixels) is covered by the same ePrivacy rules as cookies, and data protection authorities in Europe, such as France's CNIL and Italy's Garante, expect a separate consent for it, independent from the consent to receive email marketing. Check the guidance of the authorities in the countries where you send email. This guide shows how to collect that consent next to your email platform's subscribe checkbox, keep a record of it, and pass it to your email platform.

Prerequisites

  • A UniConsent project with Custom Purposes enabled (see Custom Purposes)
  • Consent DB enabled for the project, to keep a record of each choice (see Consent Logging)

Step 1: Create the Email Open Tracking Purpose

  1. In the dashboard, go to Custom Purposes and click Add Custom Purpose.
  2. In Start from a template, choose Email open tracking.
  3. The Purpose ID email_open_tracking, the name and the description are filled in, with Italian, French, German and Spanish translations. Adjust the text if needed, but keep the Purpose ID.
  4. Click Save, add the purpose to your project and Publish.

The purpose now appears in the consent banner, where visitors can grant or withdraw it at any time.

Step 2: Add a Separate Checkbox to Your Subscribe Form

Keep your email platform's own subscribe checkbox for email marketing, and add a second, unticked checkbox for open tracking:

<form id="newsletter-form">
  <input type="email" name="email" required>

  <!-- your email platform's subscription consent -->
  <label><input type="checkbox" name="subscribe"> Send me the newsletter</label>

  <!-- separate consent for email open tracking -->
  <label><input type="checkbox" name="open_tracking"> I agree that you record whether and when I open your emails (tracking pixel). Optional, separate from the newsletter.</label>

  <button type="submit">Subscribe</button>
</form>

Step 3: Record the Choice When the Form Is Submitted

When the form is submitted, give UniConsent the email address and the open tracking choice:

<script>
window._unicData = window._unicData || [];

document.getElementById('newsletter-form').addEventListener('submit', function (e) {
  var form = e.target;

  // link the consent record to this subscriber
  _unicData.push({ user_ids: { email: form.email.value }, event: 'send_identity' });

  // record the open tracking choice
  if (typeof window.__unicapi === 'function') {
    __unicapi('setCustomConsent', 2, null, { email_open_tracking: form.open_tracking.checked });
  }
});
</script>
  • The email address is converted to a SHA-256 hash (of the trimmed, lowercase address) and stored as email_hash. The address itself is not stored by UniConsent.
  • The visitor is linked to the subscriber's email_hash in the Consent DB.
  • If the choice differs from the visitor's current one, it is saved, recorded in the Consent DB and the uniconsent:update event is sent. If it is the same, for example after the visitor accepted all in the banner, the existing record stands.
  • To match records in your own systems, hash your subscribers' emails the same way: SHA-256 of the trimmed, lowercase address, in hex.
  • If your form loads a new page when it is submitted, keep the page open for a moment after this code runs, for example by submitting the form from a short setTimeout, so the record can be sent. Forms that submit in the background need nothing extra.

Step 4: Pass the Choice to Your Email Platform

Your email platform must only add the open tracking pixel for subscribers who agreed.

With the subscription

Send the checkbox value to your email platform together with the subscription, for example as a field, tag or custom property of the contact. This is the reliable way to set it for a new subscriber.

Later changes, automatically for supported platforms

When a visitor later grants or withdraws email_open_tracking, in the banner or with setCustomConsent, UniConsent sets a profile property of the same name on the email platforms it finds on the page:

PlatformProperty setRequirement
Klaviyoemail_open_trackingThe email was given with _unicData on the page
Segmenttrait email_open_tracking—
Brazecustom attribute email_open_tracking—
Brevoattribute EMAIL_OPEN_TRACKINGThe email was given with _unicData on the page; create a Boolean attribute EMAIL_OPEN_TRACKING in Brevo first

Use this property in your email platform to send emails with open tracking only to subscribers where it is true.

This works on websites where the platform's script is loaded on the page. In mobile apps, read the choice with getCustomConsents() and pass it to your email platform's app SDK.

Later changes, with your own code

For other platforms, listen for the update event to follow changes made in the banner:

document.addEventListener('uniconsent:update', function (e) {
  var allowed = e.detail['UNIC_CP_email_open_tracking'];
  // update the subscriber in your email platform
});

Visitors can withdraw open tracking at any time from the consent banner. The change is recorded in the Consent DB and passed on as in Step 4. If subscribers can also change it in your email platform's preference page, update UniConsent there too with setCustomConsent, so the consent record stays accurate.

Still have questions?

Contact us: support@uniconsent.com