- Introduction
- Getting Started
- Enable Segment App Connection in Mailjet
- Receive Data from Segment
- Send Email Event Data to Segment
- Troubleshooting
- Conclusion
Introduction
Mailjet is a powerful email service provider that enables you to send, deliver and track transactional and marketing emails all from one single account. With Mailjet, Marketers and Developers can send, deliver and track emails via API, SMTP Relay or an intuitive User Interface.
Segment allows you to capture data from every customer touch point and send it to the tools or data warehouses where it can be used most effectively.
By integrating Mailjet with Segment you can:
-
Enrich Mailjet Contact Lists from Segment Sources with New Contacts and Contact Properties
Easily add historical and future contacts to your Mailjet contact lists, as well as enrich the list with additional contact properties (e.g. name, gender, geography, purchase history) that feed into Segment from your other SaaS applications.
-
Send Email Events (opens, clicks, unsubs, bounces, …) to Segment Integrations and data warehouses
Mailjet can send all of your transactional and marketing email stats and intelligence back into 200+ Segment Integrations or data warehouses. Analyze your email growth and engagement metrics alongside your website and landing page visits, or make sure that information about your newsletter unsubscriptions are recorded in your CRM.
Getting Started
In order to connect your Segment and Mailjet accounts, you need to complete the following steps:
- Make sure you have paid accounts on both Segment and Mailjet
- Enable the Segment App Connection from within your Mailjet account
- Enable the Mailjet Integration and Source within your Segment account
- Authenticate and connect the accounts on both sides
- Select which Segment-Mailjet scenario(s) you wish to execute on the Segment App Connections page in your Mailjet Account
Enable Segment App Connection in Mailjet
Assuming you have opened paid accounts on both Mailjet and Segment, let’s start with the 2nd Step described above.
Enable the Segment App Connection within your Mailjet account
-
Go to your Mailjet Account page and click on ‘App Connections’.
If you do not see the ‘App Connections’ on your Account page for any reason, please contact our Support Team.
-
On the App Connections page, click on the ‘Configure’ button in the Segment integration block.
-
A drop-down menu will appear and you will see your ‘Segment Authentication Key’ for connecting your Mailjet account to Segment. The other options shown allow you to receive data from Segment and/or send data to Segment.
-
Copy the Segment Authentication Key provided by Mailjet to your clipboard, as you will need to paste it into Segment > Your Workspace > Mailjet Integration → Settings. Please see Step 11 below.
Enable the Mailjet Integration and Source within your Segment account
-
Now log into your Segment Account, and select the workspace where you want to add the Mailjet integration.
-
On the Sources page, click on ‘Add Source’.
-
On the ‘Sources Catalog‘ page, search for ‘Mailjet’ and click to add it.
-
Click on the ‘Connect’ button.
-
Enter a Name for your Source, then click on ‘Add Source’.
-
You will be automatically redirected to your newly created Mailjet source. Now you will need to enable the integration by using the Mailjet Segment key (that is copied to your clipboard). Click on ‘Add Destination’.
-
Search for ‘Mailjet’ and then select the result.
-
You will be transferred to a page with information about the Mailjet service. Click on ‘Configure Mailjet‘.
-
Click on ‘Confirm Source‘ to – you guessed it – confirm the Source for your Mailjet Destination.
-
You need to add your Mailjet Authentication key to enable the destination. Click on the ‘Authentication key’ menu.
-
Paste your key into the ‘Authentication key’ box and click on ‘Save’.
-
Finally, click on the ‘Activate Destination’ button to complete the integration.
Now for the big question: Do you want to receive data from Segment, send data to Segment, or both?
- To enrich your Mailjet contact lists with source data from Segment, then please read the Receive data from Segment section.
- To send email event data to Segment for use with other integrations & warehouses, please go to Send Email Event Data to Segment.
Receive Data from Segment
General Information
The Mailjet integration with Segment allows you to use the identify()
call to receive data from Segment and, more specifically, from other services that you have integrated into Segment. This method allows you to essentially update your Mailjet contact list(s) with certain contacts and traits like email address, name, geography, etc., provided by other integration services that you have previously connected to your Segment account.
How to Activate Receiving Data from Segment
On the Mailjet Side:
To activate “Receive data from Segment”, select a target Contact list from the drop down menu that you wish to have Segment send contact property data into. You can also create a new contact list at this point by selecting “Create and Use a Segment Master List”. Once you have selected a list, click on the ‘Enable’ button.
And that’s it – the ‘receive data’ feature is now enabled and Segment will start to update your contact list so that you can become and email ninja by targeting the right people with the right message through your segmenting super powers ;).
Receiving Array Data from Segment
When sending data from Segment to Mailjet, in order to successfully save your contacts’ properties, you can do it either by listing the details one by one, or by sending them combined in an array of data.
Here is an example of a data payload containing traits with an array:
"traits": { "location": { "latitude": 48.87347532650291, "longitude": 2.371577412596885 } }
Mailjet will then break apart the location
array into two properties (for location_latitude
and location_longitude
), then store the contact properties for the respective contact.
Receiving Data from Segment in Nested Arrays
However, if the information is sent from Segment in the form of a nested array (array with another array contained in it), Mailjet will not be able to properly parse the information. The contact will be successfully created in the contact list, but the nested array data will be ignored.
As an example, look at the below information sent from Segment to Mailjet:
"traits": { "first_name": Sherlock, "last_name": Holmes, "location": { "latitude": 51.523760, "longitude": -0.158459 }, "address": { "city": London, "street": { "name": Baker Street, "number": 221B } } }
The traits sent to Mailjet will be handled as follows:
-
first_name
andlast_name
will be accepted and saved, as they are simple details. - The information contained within
location
will be split intolocation_latitude
andlocation_longitude
and stored, respectively, as this is a simple array, which can be decomposed by Mailjet into separate properties. - The information contained within
address
- city, street name and street number - will not be saved, as it is contained in a nested array and cannot be properly decomposed.
Send Email Event Data to Segment
Oh, but wait. The Segment App Connection keeps on giving and not only enhances your contact lists but can also send your email event data (opens, clicks, bounces, etc.) back to Segment just in time for you to earn your big data black belt. This is helpful if you want to put your Mailjet event data alongside other engagement or traction data (for example: Mixpanel, Google Analytics, your CRM, etc.).
Activate Send Data to Segment
On the Mailjet Side:
To activate “Send data to Segment”, you will need to enter your Segment “Write Key” into the Mailjet Segment Page as shown below.
Your “Write Key” is provided by Segment and is used to identify Segment’s client account so that the Mailjet system knows where to send data to and where to receive data from.
You can quickly find your Segment Write Key by using this link:
https://app.segment.com/[WORKSPACE]/sources/[SOURCE_NAME]/settings/keys
(Where you need to replace [WORKSPACE] and [SOURCE_NAME] with the names of your Segment workspace and source, respectively).
Or you can log into your Segment account, select your workspace and source, then click on ‘Overview’.
-
Copy the “Write Key” from your Segment page.
-
Jump back to your Mailjet account, paste the Write key code Into the Send data scenario and click on the ‘Enable‘ button.
-
Mailjet will then generate an EndPoint URL and populate it on the Triggers page of your account.
-
All events are selected by default. Should you want to send only certain events to Segment, just uncheck or keep checked the different event types and click on ‘Save’.
Please note: if you already have an EndPoint URL on your Triggers page, the following pop-in will appear:
You then need to decide which option to use:
- Keep existing endpoints – keep the existing endpoint URL and the option “Send Data to Segment” will NOT be activated.
OR
- Replace with Segment endpoints – replace the current endpoint URL on the Trigger page to allow Mailjet to send events to Segment.
Finally, the information that is forwarded to your Segment account is dependent on the kind of events you specify in the Segment account. The events that are supported by Mailjet and Segment are:
- Open events – sent as “Email Opened” to Segment
- Click events – sent as “Email Link Clicked” to Segment
- Bounce events – sent as “Email Bounced” to Segment
- Spam events – sent as “Email Marked as Spam” to Segment
- Blocked events – sent as “Blocked” to Segment
- Unsubscribe events – sent as “Unsubscribed” to Segment
- Sent events – sent as “Delivered” to Segment
Tracking Campaigns
Thanks to the ‘Send Data to Segment’ functionality, you are able to also track your campaigns as a whole. Simply access your Segment account and filter the event data by campaign name.
However, for transactional emails the campaign name that appears in Segment will be taken from the Subject of the email. As quite often the email subjects are personalized (e.g. “Thank you for registering, Mr. XYZ” or “Your Order #XYZ was Accepted”) you may not be able to properly filter the results for the emails you want.
To make it easy for you to filter through your event data, we offer two additional technical solutions:
-
Grouping emails into a campaign - You can set a campaign name in the
CustomCampaign
property and Segment will receive it ascustomcampaign
parameter. Also the emails will be grouped in Mailjet under the name you have set forCustomCampaign
.For more information please click here.
-
Tagging the emails - You can set a tag or campaign name in the
CustomID
property. Segment will receive this information in theCustomID
parameter, so you can use it to filter through your emails using that property.For more information please click here.
Troubleshooting
- If you delete the contact list that you selected for the ‘Receive Data from Segment’ feature, Segment will not be able to send any data to that list. To fix this, you will need to associate another contact list with the ‘Receive Data from Segment’ feature on your Apps Connections page.
- Should you run into any issues, please contact us and our awesome Customer Support team will be more than happy to assist you!
Conclusion
We hope you find this plugin helpful. Let us know what you think of our plug-in, or especially what functionality we should do next, by emailing plugins@mailjet.com.
Happy Segmenting,
Mailjet Integrations Team