How to Configure Mailgun Click and Open Tracking in Your CRM
This guide explains how to set up Mailgun webhooks and domain tracking to monitor email engagement metrics within your CRM. Once configured, your CRM will display accurate click rates, open rates, unsubscribes, bounces, and spam complaints for emails sent via Mailgun.
Prerequisites
Before you begin, ensure you have:
- An active Mailgun account with at least one verified sending domain
- Admin access to your Mailgun account to manage webhooks and domain settings
- Your sending domain already connected and active in the CRM
Add the Webhook in Mailgun
Mailgun webhooks send real-time email event data to your CRM. You must add a domain-level webhook for each sending domain you use.
Step 1: Navigate to Webhooks
Log into your Mailgun account. In the left sidebar, go to Send → Webhooks. Click the Domain-level tab and select your sending domain from the dropdown menu.
Step 2: Create a New Webhook
Click Add webhook in the top-right corner. In the dialog box, enter the following details:
- Description: Enter a descriptive name, such as "CRM Event Tracking"
- HTTP post URL: Paste the following URL exactly:
- Domain: Select your sending domain from the dropdown
Step 3: Select Event Types
Under the Events section, check Select all to enable all event types. This ensures your CRM receives data for:
- Accepted
- Delivered
- Opens
- Clicks
- Permanent failure
- Temporary failure
- Spam complaints
- Unsubscribes
Step 4: Save the Webhook
Optionally, click Test next to the URL field to verify the endpoint is accessible. Once confirmed, click Save. The webhook will appear in your domain-level webhook list.
Note: Repeat this process for each sending domain in your Mailgun account. Webhooks are domain-specific and must be configured individually.
Enable Click and Open Tracking on Your Domain
In addition to the webhook, you must enable tracking features in Mailgun's domain settings to monitor link clicks and email opens.
Step 1: Access Domain Settings
In Mailgun, go to Send → Domains. Click on your sending domain, then select the Settings tab.
Step 2: Enable Click Tracking
Scroll to the Tracking section. Next to Click tracking, click Edit and toggle the setting to On. Save your changes.
Step 3: Enable Open Tracking
In the same Tracking section, click Edit next to Open tracking and toggle it to On. Save your changes.
After enabling both settings, verify the following configuration:
- Click tracking: On
- Open tracking: On
- Tracking protocol: https
- Tracking certificate: Active
Note: For click tracking to function correctly, you must add a tracking CNAME record to your domain's DNS. Mailgun displays the required CNAME under Domain Settings → DNS Records. If the tracking certificate shows as inactive, the CNAME may be missing or not yet propagated.
Configuration Complete
Once the webhook is saved and tracking is enabled, your CRM will begin receiving real-time data for clicks, opens, bounces, unsubscribes, and spam complaints. Email analytics dashboards will reflect accurate engagement metrics for all emails sent through this Mailgun domain.
Frequently Asked Questions
Why am I not seeing click or open data in my CRM after adding the webhook?
Common causes include: (1) Click or open tracking is not enabled in Domain Settings → Tracking, or (2) The webhook was added at the account level instead of the domain level. Verify both settings and send a test email to confirm events are recorded.
Do I need to add the webhook for every domain?
Yes. Mailgun domain-level webhooks are scoped to individual domains and must be configured separately for each sending domain.
Will enabling click tracking affect email deliverability?
When configured correctly, the impact is minimal. Click tracking redirects links through a tracking subdomain (e.g., email.yourdomain.com). Using your own tracking CNAME instead of Mailgun's shared domain helps maintain email reputation. Ensure the tracking certificate is active to prevent broken links.
The webhook test returned an error. What should I check?
Confirm the webhook URL is entered exactly as provided, with no extra characters or trailing slashes. Verify your network settings allow outbound calls to external endpoints. Check the Failure logs tab in Mailgun Webhooks for detailed error information.
I already have a domain-level webhook. Should I update it or create a new one?
If your existing webhook uses the correct URL and includes all event types, no changes are needed. If the URL is incorrect or events are missing, edit the existing webhook via the three-dot menu instead of creating a duplicate.
Does this setup track emails from all campaigns?
Yes. All emails sent through the configured Mailgun domain will have events forwarded to the CRM. The CRM associates each event with the relevant contact and campaign based on email header metadata.
What happens if the tracking CNAME record is missing?
Without the CNAME, the tracking certificate will show as inactive, and click tracking links may not function correctly. Add the required CNAME record to your domain's DNS to resolve this issue.