I want to use the contact hash in emails url’s instead of their email address for privacy. Like discussed here: Include hash in e-mails
But I want event tracking to function as well. In the API documentation for track_event_add (API Examples Using track_event_add) it doesn’t state whether or not you can pass the contact’s hash to associate the event with the contact. The example shows using the email.
I am only a amateur programmer, so I hired a programmer to change my plugin to use hash instead of email, but they are running into problems so I thought I’d better ask here. It’s possible I don’t really understand what’s going on at all and am confusing different things.
If it is possible to use the contact hash with tracking, how?
Thoughts?
(Or, maybe we need to use email and lookup the email from the hash? But that would cause an additional api call I would think?)
The first email you referenced is a bit different use case. We use the email address as a special type key field, to look up the contact.
Unfortunately this means that using the hash with event tracking directly is not possible at this time, however you could create some sort of key-value pair on your server, to prevent email address from being exposed server-side.
So for example, your project might have a user-id that you can use. So you could write your own javascript method for the client, POST that to your server/app --> have the server/app find the email address for the user-id received --> call the event tracking method. This has the added benefit of keeping your AC event tracking keys off of the client.
OR you could use a tool like BigPicture.io or Segment to handle client-side event tracking for you. They have already handled much of this abstraction away for you.