What is Segment?
Segment allows you to easily manage integrations with multiple analytics services. By tracking events and users via Segment’s API and libraries, you can send your product’s data to all of your analytics/marketing platforms, with minimal instrumentation code. They offer support for most platforms, including iOS, Android, JavaScript, Node.js, PHP, and more.
Mutiny and Segment have a partnership, so that our shared customers can successfully send data to our platform via Segment’s various integrations. It is quickly processed and displayed in the Mutiny platform for analysis.
This guide is meant to complement Segment’s integration doc. It provides additional details on how to send your data to Mutiny, and instructions for setting up the integrations.
Note: Adding Mutiny as a Segment destination does not implement the Mutiny JS on your site. You still need to add the Mutiny code to the head of your page - see instructions here.
How it works
Mutiny can use Segment data for both conversion tracking, as well as integrating 1st party data.
Mutiny + Segment
Mutiny integrates with Segment to allow customers to use Segment events to track conversions in Mutiny. Integrating with Segment also allows you to use Segment traits to create segments for personalization or dynamically insert Segment trait values into your personalized pages.
Mutiny will also send back events when visitors have seen personalized experiences. This is a great way to track attribution for Mutiny experiences in your reporting systems. Mutiny will send the event "Mutiny Experience Viewed" with properties audienceSegment (name of visitor segment), experience (name of experience), and personalized (true for personalized experience, false for control).
Mutiny + Segment + Salesforce
When both Segment and Salesforce are integrated, Mutiny will connect the user's email passed through a Segment trait with the associated Salesforce record in either your Leads or Contacts table. Map all actionable Salesforce fields from these tables to create segments and personalize by Salesforce data fields. More info on that here.
Note: The trait value must be exactly "email". Other casings or phrasings will not work.
Setting up your integration
Step 1 - In Segment, add Mutiny as a destination. To do this, click "Catalog" in the left panel, search for "Mutiny", click on the destination icon, click "Configure Mutiny", select the relevant source, and add your API key (you will find this on your Segment Integrations page in Mutiny). Hit Save and click the toggle to enable the integration.
Step 2 - Repeat step 1. for all relevant sources. This may include your corporate/marketing website, your product, and your backend server. You must include Mutiny as a destination on whichever source(s) set the events and traits you would like to use in Mutiny. You must also have Segment running on your public website so Mutiny can call identify and associate Mutiny users to Segment users.
As an example, if your sign-up flow is inside your product, you need to add Mutiny as a destination on both your marketing website and your product source. If your identify and track events are called in your backend server source, you will need to add Mutiny as a destination there, as well.
Step 3 - Configure the events you want to track as conversions in the Conversions tab in Mutiny (see instructions here).
Step 4 - You're done! You should now see all your Segment traits available as options in Mutiny's Segment Creator. Note that all traits from sources connected to Mutiny will be added automatically - no mapping needed.
Technical integration details
Segment Source (client-side JS)
With the Mutiny JS client configured on your webpage, we can associate user data about your anonymous visitors through the Segment identify
call. We also track events about what experience a user sees, what segment they are a part of, and whether they saw the control or personalized version.
Requirements
analytics.js installed on your webpage, correctly configured with your API keys. See Segment's quick start guide here if you are just getting started.
Identify
Mutiny maintains a unique identifier for every visitor that comes to a webpage running the Mutiny JS client. This identifier is stored in a cookie and persisted across sessions and return visits. Segment's analytics.js also maintains an anonymousId
that tracks visitors across sessions, and we associate Mutiny's visitor_id
and Segment's anonymousId
using a call to identify, like this:
analytics.identify(null, { mutinyVisitorId: '1234' });
This allows the Mutiny visitor_id
to be associated with the user as a Segment trait
, and later associated with events deeper in the funnel once the user has been identified or converted. By calling identify with null
as the userId
, we maintain the visitor's anonymous identity to allow you to associate your own database ID when they register.
Track
Once you have configured an experience for different audience segments using Mutiny, the Mutiny JS client will identify users coming to your site in real time, bucket them according to their unique attributes, and track them as either control or render a personalized experience for them. If a user is not identifiable or does not fall into a configured audience segment, they are excluded from our tracking.
Once a visitor is identified to be within a segment, we split the traffic into personalized and control groups. Splitting the traffic after they are identified within the segment allows us to avoid audience bias and measure accurate lift. Each time they view a page with personalizations, we use Segment's track call to record the event to your public website source (whichever source is running on the same domain where the Mutiny script is running).
For a personalized view, track is called like this:
analytics.track('Mutiny Experience Viewed', {
experience: 'Corporate Website Experiment',
audienceSegment: 'Small company',
personalized: true,
});
For a control view, track is called like this:
analytics.track('Mutiny Experience Viewed', {
experience: 'Corporate Website Experiment',
audienceSegment: 'Small company',
personalized: false,
});
This allows downstream analytics sources to find all users who were identified in a particular audience segment, and see how conversion is affected for personalized vs control groups. We track these views as events, instead of associating traits on the user level, so we have a historical record that represents how experiences and audience segments change over time.
Troubleshooting
If you have having issues with the integration, check out this troubleshooting guide for areas you can check.
Having Integration Issues?
Contact Mutiny support via intercom chat or at support@mutinyhq.com and we'll be happy to help resolve them.