Back to main menu

Product

Geolocation and user agent detection now available In webhooks

With the new geolocation parameters in open, click and unsubscribe webhooks, Mailgun can provide so much more to our customers. Read more –

PUBLISHED ON

PUBLISHED ON

We believe in doing hard work for our customers. So when we decided to add geolocation and user agent parameters to our open, click and unsubscribe webhooks, we decided to take it one step further than simply providing an IP address and a raw user agent string for customers. Providing only these values forces you to translate IP to city or country and to delve into the obscure world of user agent strings to find out if the email was opened on a tablet or desktop or whatever. You’ve got better things to do, so here are the details.

With the new geolocation parameters in open, click and unsubscribe web hooks, Mailgun provides the following:

IP– IP address the event originated from.

Country– Two-letter country code (as specified by ISO3166) the event came from or ‘unknown’ if it couldn’t be determined.

Region– Two-letter or two-digit region code or ‘unknown’ if it couldn’t be determined.

City- Name of the city the event came from or ‘unknown’ if it couldn’t be determined.

In short, you still get the IP address, but you also get the most common information that can be derived from IP address, without any additional parsing or decoding on your end.

For user agent detection, you get

User-agent– User agent string of the client triggered the event.

Device-type– Device type the link was clicked on. Can be ‘desktop’, ‘mobile’, ‘tablet’, ‘other’ or ‘unknown’.

Client-type– Type of software the link was opened in, e.g. ‘browser’, ‘mobile browser’, ‘email client’.

Client-name– Name of the client software, e.g. ‘Thunderbird’, ‘Chrome’, ‘Firefox’.

In short, you get the plain English version of user agent, without writing your own parser.

See our docs for a full list of web hook parameters for opensclicks and unsubscribes.

Review on setting up webhooks

If you want to capture this detailed geo-location and user agent data in your application, say, to create custom reports in your email marketing application built on top of Mailgun, its really easy. All you have to do is set up a webhook in the Mailgun Control panel. When you specify a url where you will accept POSTs, Mailgun will send you all these parameters.

Anything else you’d like to see passed in webhooks? Let us know in the comments.

The Mailgunners

Related readings

BFCM 2024: How email and omnichannel communications drove holiday success

Black Friday and Cyber Monday represent peak email sending periods that can make or break retailers' holiday success. During November...

Read More

How to improve your email deliverability for the future of email

If your customers aren’t getting your emails, then there’s a good chance that your email program needs some refreshing with these email deliverability tips taken from Email Camp: MessageMania speaker and industry pro, Laura Atkins.

Read More

Bulk validations: Accurate and fast AF

Cleaning an old email list is one of those must needed chores that nobody really wants to do...

Read More

Popular posts

Email inbox.

Email

5 min

Build Laravel 11 email authentication with Mailgun and Digital Ocean

Read More

Mailgun statistics.

Product

4 min

Sending email using the Mailgun PHP API

Read More

Statistics on deliverability.

Deliverability

5 min

Here’s everything you need to know about DNS blocklists

Read More

See what you can accomplish with the world's best email delivery platform. It's easy to get started.Let's get sending
CTA icon