Reputation: 232
I am using mailgun to send an email campaign to multiple recipients and I need to track how many were opened vs. how many were sent. Currently, I have setup a webhook to track the open events from mailgun. In order to determine which campaign an email is a part of, I am trying to use tags (I'm not using actual mailgun campaigns because I want to be to create these on-the-fly and not have to worry about limits). Looking at the mailgun logs, I can see that the tags are being set correctly on outgoing emails.
Here's my issue: when the email is opened, mailgun logs the event and triggers the webhook, but somehow the tags array is empty.
If I'm understanding the documentation correctly, I should be able to see the tags from the open event: https://documentation.mailgun.com/user_manual.html#tracking-opens
So what I am wondering is why the tags aren't carrying through to the open event and if there is a better way I should be tracking campaign opens.
Thanks in advance.
Upvotes: 1
Views: 793
Reputation: 232
After looking into this further and even getting in touch with mailgun support, it seems that I was mistaken as to the actual issue. The webhook was being triggered in some cases, but not all. The campaign emails were not triggering the webhook, but other system emails were (which is why there were no tags present in the emails that came through).
To resolve this, I had to explicitly set the o:tracking-opens flag to true on each of the campaign emails even though it was already set to true in the mailgun control panel.
Hopefully this helps someone else out who may be having similar issues.
Upvotes: 2