Solved

Track Email Opens from 3rd Party Emails

  • 4 February 2020
  • 7 replies
  • 157 views

I see this in the documentation: 

Mixpanel tracks email open rates using pixel-based Event tracking. Mixpanel adds a URL directed to http://api.mixpanel.com/track/ into the src attribute of the HTML image tag within the email.

The format for the URL of the embedded image is the same as the URL for a regular Mixpanel request, except with &img=1 added to the end. By adding &img=1, Mixpanel will return a 1 pixel x 1 pixel transparent gif that triggers an event when it loads.

Does this mean I should be able to drop some URL into any email to track opens? If so, what is the format of said URL? Thanks All!

icon

Best answer by raja 6 February 2020, 23:01

api.mixpanel.com/track?data={params}&img=1

If you have an email with the tracking image link embedded in the HTML, find the data={params} part of the URL from the example format above.

The params are url encoded + base64 encoded, after you decode them you should be able to figure out how the params are structured similar to a typical mixpanel.track() SDK call.

Of course this isn’t publicly documented information so it is possible that the format may change in the future. To be fail-proof I would recommend making a simple endpoint on your webapp and embedding that endpoint as an <img> tag in your email HTML.

The endpoint would just have to load the Mixpanel SDK and do a standard track() call with your desired properties.

View original

7 replies

Userlevel 1
Badge
api.mixpanel.com/track?data={params}&img=1

If you have an email with the tracking image link embedded in the HTML, find the data={params} part of the URL from the example format above.

The params are url encoded + base64 encoded, after you decode them you should be able to figure out how the params are structured similar to a typical mixpanel.track() SDK call.

Of course this isn’t publicly documented information so it is possible that the format may change in the future. To be fail-proof I would recommend making a simple endpoint on your webapp and embedding that endpoint as an <img> tag in your email HTML.

The endpoint would just have to load the Mixpanel SDK and do a standard track() call with your desired properties.

Thanks Rajak!

Do the data params include the mixpanel account ID? I don’t know how the pixel would know where to send the data.

Thoughts?

Userlevel 1
Badge

Thanks Rajak!

Do the data params include the mixpanel account ID? I don’t know how the pixel would know where to send the data.

Thoughts?

There is a token in the base64 encoded params

Unfortunately, I don’t have an existing token.

I think i have the token now...but i just need to know what the param name actually is. Anyone got that?

Userlevel 1
Badge

I think i have the token now...but i just need to know what the param name actually is. Anyone got that?

Psuedo code:

properties (json object) = {
  "distinct_id": "your user’s id"
  "token": "your token"
}
data (json object) = {"event": "event_name", "properties": properties}

tracking_url = "http://api.mixpanel.com/track?data=" + urlencode(b64encode(params)) + "&img=1”

Something like this should work. However, I just want to repeat this warning:

Of course this isn’t publicly documented information so it is possible that the format may change in the future. To be fail-proof I would recommend making a simple endpoint on your webapp and embedding that endpoint as an <img> tag in your email HTML.

The endpoint would just have to load the Mixpanel SDK and do a standard track() call with your desired properties.

It probably complicates things that I’m using Segment to run everything, doesn’t it? 

Thanks for all your help!!!

Reply