0

I am trying to track the number of email opens of a mailing. This mailing is not personalised, so each receiver will get exactly the same email contents.

So far I have found out that I can add a tracking pixel in the mailing, which will send data to GA that a user opened the mail (images were loaded).

Example code:

<img src=”http://www.google-analytics.com/collect?v=1&tid=UA-XXXXXX-X
&cid=EmailOpenTest&t=event&ec=email&ea=open&el=EmailOpenTest
&cs=newsletter&cm=email&cn=Email&cm1=1″ />

'tid' will be our custom tracking ID.

This all works, as when this link is opened the total number of hits increases.

But my question relates to parameter 'cid'. For testing purposes, I have set this here to "EmailOpenTest". But this should be a random/unique ID per user actually. But as the mailing is not personalised, I wonder if it would be possible to track individual users?

Does this mean I have to include javascript in the mail? Would that even work in all email clients? Or are there other options? All suggestions are welcome.

Johan
  • 931
  • 9
  • 23
  • You cant send email but you could send a hash of email if you have the power to hash it (run it though MD5 or something). Google doesn't like you sending email addresses though the measurement protocol. How are you sending the emails exactly? – Linda Lawton - DaImTo Apr 25 '17 at 10:56
  • The cid would be something like 61431.12463, not an email address. From what I have found, this can be generated through googleanalytics.js. (http://stackoverflow.com/questions/20053949/how-to-get-the-google-analytics-client-id ) But I am a bit worried about adding javascript to a mailing. The mail is send by a custom script, sending batches to users of the same domain. – Johan Apr 25 '17 at 11:11
  • cant your script generate a unique number for each user and add that to the mail. I agree with not liking adding javascript to an email. – Linda Lawton - DaImTo Apr 25 '17 at 11:14
  • @DaImTo, Google requires at least SHA256 when hashing personal data (of course that falls under the "or something" category, but md5 itself is prohibited by the terms of service). – Eike Pierstorff Apr 25 '17 at 11:53
  • Johan, DaImTo suggested a hashed mail address since this would be by definition unique per user. GA itself is not particularly concerned with the format of the clientID, it just needs to be unique and must not contain data that can identify a person (hence the requirement to use a strong hashing algorithm). You could use the time in milliseconds or entries from the phone book for all that Google cares. JS will not work in most email clients, as that would be a security concern. Some (e.g. Google) will store a cached version of GAs tracking pixel, so the count won't be accurate even so. – Eike Pierstorff Apr 25 '17 at 14:14
  • @Johan try with my answer and let me know if this resolves. :) – Tushar Gupta Apr 25 '17 at 17:21

2 Answers2

2

Assumption: you are using a mail client like Mail Chimp

  • Assign a unique id to every email on the email list. lets say this unique id is uid
  • Create a custom dimension in GA, lets name it as Client Mail Id with index say 1
  • Create the same pixel just like you have created above in the OP.
  • Add a custom Dimension in the hit as

    http://www.google-analytics.com/collect?v=1&tid=UA-XXXXXX-X &cid=EmailOpenTest&t=event&ec=email&ea=open&el=EmailOpenTest &cs=newsletter&cm=email&cn=Email&cm1=1&cd1=uid

  • In place of uid, you actually need to pass the mail list unique id for that email


How it will work

  • Once the user sends this hit, your unique id will be recorded in custom dimension 1.
  • Generate a custom report in GA with event category=email & event action=open and add a dimension custom dimension 1.
  • All the id's displayed there have actually opened the email ;)

PS: It's tried and tested, so won't cause any issue. Also if you don't want to use custom dimensions, you can also send this id in event label or event value

PPS: In any mail client, getting unique value for that email is pretty easy. You can actiually use its position number or add another column for the unique id, then grab that id win the template

Tushar Gupta
  • 15,504
  • 1
  • 29
  • 47
  • Since GA aggregates sessions/users by client id this would still produce a single user to whom all the email opens are attributed (even if you then can break it down by the custom dimensions). So I am not sure this solves the problem from the original question. – Eike Pierstorff Apr 26 '17 at 07:17
  • In Measurement protocol, client id is optional if user id is provided, so if it can be send as user id, + as a custom dimension, it can be still used – Tushar Gupta Apr 26 '17 at 08:33
  • Calling a custom dimension uid does not make it a user id. And since a user id must not be persisted after a sessions end it might not be within the scope of the TOS to include it into an external link. – Eike Pierstorff Apr 26 '17 at 08:36
  • 1
    @Tushar We just send the mailing as a static content email. No MailChimp is involved. But according to the feedback I got here, I think we should re-evaluate how we send the mailings. Thanks for your feedback – Johan Apr 26 '17 at 10:26
1

The cid is the clientId, an identifier that is used to aggregate pageviews into sessions, and sessions into unique users.

The way to use that in email-tracking would be to capture the client id when a user subscribes to your newsletter and then insert it into the email links. Since your mails are not personalized this will not work.

If you use a random ID you will not be able to link the request from the mail to an existing user. So one way to deal with the problem would be to ignore it - using a constant userId would still give you an event count (the unique events metric might be a little of if users click the link multiple times within a session lifetime).

If for some reason you absolutely need to track these as different users you can set up a redirect - do not send data to ga directly from your mail, instead call a script on your server that inserts a random clientId and then sends the data to Google.

Eike Pierstorff
  • 31,996
  • 4
  • 43
  • 62
  • Hm, thanks for your explanation. Not the answer I hoped for, but I am more confident now that what I suspected is indeed true. – Johan Apr 25 '17 at 13:32