Dev.to Security 🔐 Cybersecurity 👁 0 📖 6 min read

Email Tracking Looked Simple. Privacy Made It Complicated.

Dual pixels Ever tried to track email opens, only to discover that your emails contained two tracking pixels instead of one? We did. At Notifizz, we built our tracking system, with consent rules. But, our email servic

Dual pixels

Ever tried to track email opens, only to discover that your emails contained two tracking pixels instead of one? We did.

At Notifizz, we built our tracking system, with consent rules. But, our email service provider also added its own tracking pixel. A wrong configuration on our end meant that we could track things without consent. It also defeated the domain isolation per client that we had put in place. Not brilliant. Thankfully, we caught it very early in development by discovering two pixels in the HTML of an production email.

When dealing with notifications, it's nice to have more feedback than just "the email has been sent". Did the user even open the email? Did he click on the links? Which one? Having an idea on what happened allows you to change your strategy or your wording and create email campaigns that actually meet your business goals.

In this article, I'll explain how we tackle this issue at Notifizz, in the European context of GDPR. What we learned, what failed, and the solutions we implemented as a notification platform.

Why we wanted email tracking

One frustrating thing about a marketing campaign is not knowing why it doesn't work. Because, there is a difference between an email that's never opened, an email opened but never interacted with, and an email that received interaction.

In the first case, if it's never opened, you might have to ask yourselves if your segmentation was correct. Personally, if I receive an email trying to sell me a 50-meter yacht, I won't open it, I'm not in the market for that. Although, you also have to be aware that certain systems like Apple Mail Privacy Protection makes it difficult to know for certain if a user opened an email.

In the second case, the user opens it, reads it, and does nothing else. Now, if you know this, you might wonder: ok, the user seemed interested but the email might be poorly worded, and we didn't convince the user to take the action(s) we wanted him to take.

In the third case, let's say you want to convince users to come back to your application after a long absence (you know, the good old Duolingo harrassment method). If you know that the user clicked on your link to come back, you can be confident that the email targets the right people with the right wording and you might not need to spend more time on this campaign.

So, this is why we wanted to handle email tracking in Notifizz, to give marketing teams a better understanding of their campaigns. However, we quickly learned that metrics are imperfect.

The privacy problem

Because we are in Europe, we have to deal with GDPR (General Data Protection Regulation). GDPR is the European rules that deals with personal data. These regulations are set in place to protect users' data from public or private organisations. To give you an overview, the regulation tells us that:

  • you must collect data for specified, explicit and legitimate purposes, and every processing needs a legal basis. GDPR lists six (art. 6.1): consent, contract, legal obligation, vital interests, public task and legitimate interests. Consent is only one of them: a password reset email needs none, because it's part of the service the person signed up for. And consent can't save an illegitimate purpose. A recruiter asking candidates about their religion or their plans to have children breaks the rules even with their consent: a candidate can't freely say no, and the question has nothing to do with the job.

  • you must collect the minimum of data possible for your purposes and keep them only for the time you require them. Once you have no use for them anymore, they need to be deleted. One insurance company in France recently received a 5 millions euros fine because they kept contact data and connexion data for more than 10 years (!). They did other bad things like keeping passwords in plain text... Good job guys. CNIL decision

  • Depending on the purpose, certain pixels require prior consent. Other, with strict reasons, don't. For example, having a pixel to secure authentication may qualify for a consent exemption (if you send an email with a connection code, you want to make sure the user open it on a known device for example) CNIL recommendation

For information, pixels' consent is not defined by GDPR, but by another european rule, ePrivacy (2002/58/EC, art. 5(3))

It would take a lot of articles to go through all the regulations of GDPR and their implications but you get the gist of it.

The decisions we had to make

  • Who collect consents? It's the sender's responsibility, not us as subcontractors. The sender gives us the consents through SDK or a CSV import (for each of his users). We didn't host a consent page because then we would have to hold the proof of the user's consents. Then it complicates things because we would know everything (the text displayed, which version, when the user consented or not ...). In the case of an audit, we would then have to provide the proof of consents.

These are our choices, the page of consent could have been on our side but it is optional for the subcontractors to do this. CNIL recommandation

  • Receive and be tracked are two distinct things. Deny tracking doesn't mean forbidding sending a notification. An untracked email has no pixel and no rewritten link (in a tracked email, links are redirected through our platform, measured then redirected to the actual link. That's called link wrapping).

  • A refusal always wins, even on emails already sent. If an email is sent and the user withdraw his consent after, it still redirects through us then the real page but the click doesn't exist for us. Same for the pixel, it's not counted.

Withdrawing consent doesn't make past measurement unlawful (GDPR art. 7(3)). But once consent is gone, nothing justifies keeping it tied to the person: we've built a nightly pass that erases their individual opens and clicks and keeps only totals with no identifier.

  • When in doubt, no one is measured. Seems like an obvious one, but if we can't read the consent status, we don't track. If we can't read someone's consent status (a failed query, a timeout), no one is measured: a failed read never counts as "not opposed".

  • A tracking link carries no name. Each tracking link carries a token encrypted with AES-256-GCM: no one can read it, and any change to it is detected. It names the message and the button, never the person: who received that message is known only on our side. When you click, we send you on right away, then look up the message to decide whether the click can be recorded. If the person has been erased, there is nothing left to look up: the link still works, and the click counts for no one.

  • Honest numbers. A non measured email appears as "Not measured", never as 0%. Rates are computed only with measured sends.

What we learned

  • When it comes to GDPR or ePrivacy, you need to read the texts, not just a summary. At first, we believed that an anonymous pixel didn't require consent, the CNIL said otherwise.

  • We thought we had to host a consent page. That's only an option

  • The legal rule is simple, the identity is not. The same email address can be used by several accounts. The consent of one can't lift the withdrawal of another. That's why we store the consent per identity rather than on a recipient's record.

We changed opinions several times and that's ok. We did in-house pixel, then sealed token, then consent per channel.

It's been one of the most complicated areas to implement because there are a lot of different rules to follow. Yet, it has to be comprehensible enough for our users so that they don't get drowned in countless settings while letting the recipients give or withdraw their consent without hurdles.

In the end, we learned a lot about building a system that respects European privacy regulations. It was also a fun experience to explore the different use cases and understand what is legally permitted and technically possible.

Try Notifizz for your notification workflows

📰 Read the original article on Dev.to Security

Originally published by Dev.to Security. Aggregated on AIWithGhost for educational purposes — full credit and traffic to the original publisher.