Mandrill supports automatic Google Analytics tracking for your links. We need two pieces of information to add this tracking:
A list of domains which are eligible for Google Analytics variables. Some links don’t work as intended when a query string is added, or if arbitrary things are added to the query string. To avoid this, you’ll tell Mandrill which links are intended to receive the Google Analytics variables.
A Google Analytics campaign. What this actually means is up to you: it is frequently a Google search campaign, but you could technically put whatever tracking variable you want in here. It’s what gets added to the
utm_campaignparameter. If no value is provided, the
Fromaddress for the email is used by default.
Add Google Analytics Tracking
X-MC-GoogleAnalytics: a comma-separated list of the domains to have Google Analytics tracking added
X-MC-GoogleAnalyticsCampaign: the value Mandrill will set for utm_campaign variable
For the API, when using the messages/send or messages/send-template endpoints, set the following within the message parameter:
google_analytics_domains: an array of strings indicating for which any matching URLs will automatically have Google Analytics parameters appended to their query string automatically
google_analytics_campaign: optional string indicating the value to set for the utm_campaign tracking parameter
Be sure to include any subdomains used in your URLs so Google Analytics tracking can be added. For example, if your message contains links to both
google_analytics_domains array would look like:
"google_analytics_domains": [ "www.domain.com", "domain.com" ], . . .
X-MC-GoogleAnalytics header would look like:
X-MC-GoogleAnalytics: www.domain.com, domain.com
It's not possible to change the source (utm_source) that's included when using Mandrill's automatic Google-Analytics tracking code. If you want more control over the parameters being added, we recommend adding the Google Analytics parameters manually before passing the emails to Mandrill for processing.