Just tested mailgun through its API.
Everything is working fine.
Short: How to track unique opens for a specific mail through webhooks.
(Not necessarily relevant but for completness I use Yii2 PHP framework - no extension, just the quick start php code from mailgun)
The emails get sent and it tracks the open event. But I discovered that it tracks every single open of the same mail.
So what is the best way to track if a specific mail is opened (through webhook). Which data is best for identifiing the specific email or better use “custom variables” when sending?
Ok I think I got an acceptable workflow - through the “custom variables”.
You can define different values for each recipient, so you can send a unique id and then track that id on the open events. And just save one open for each sender or update the open time.
My sending code (PHP):
Then in each event you get a response with the unique ids.
Open event of first email:
Open event of second email:
Best way to track email openings is so called "pixel". First you need to inject pixel in your email.
For example:
Which points to php endpoint. At that endpoint you will get openings and do w/e you want with them.
For example:
This code adjusts open's counter for mailing campaign for example and returns 1x1 transparent
.gif
image.It's not 100% precise because some people not loading images in emails, but its best way I know so far.