Feeling stuck with Segment? Say 👋 to RudderStack.

SVG
Log in

Feeling stuck with Segment? Say 👋 to RudderStack.

SVG
Log in

Blogs

How to Migrate from Segment to RudderStack

Written by
Benji Walvoord

Benji Walvoord

Blog Banner

Why Migrate From Segment To RudderStack?

On the surface, RudderStack and Segment look like very similar applications. If you’ve already gone through the pain of standing up your Segment instance, you’re probably kicking yourself for not having read this sooner. But if you’re still on the fence about why you should switch from Segment to RudderStack, here are some things to consider:

The fundamentals

RudderStack is a developer focused CDP featuring robust APIs built to use your data warehouse. The bottom line is that we do not believe in holding your data hostage. For a full head-to-head rundown of the tools, check out our RudderStack versus Segment feature comparison.

Advanced features

We built RudderStack for developers, and the product includes a number of advanced features that are worth highlighting before we jump into how easy it is to switch from Segment.

Transformations: You can run JavaScript functions on the live event stream or DBT models on at-rest data, then send the results to your entire stack. Transformations leverage standard Javascript libraries allowing you to code in a robust language you already know.

Data Governance API: Extend JSON payloads with rich metadata on your event stream and integrate with your existing alerting system and CI/CD pipeline, then push schema enforcement back into system—all via API.

Rich Grafana Dashboards: Get a real-time view of events, see performance under load and get rich statistics about event delivery.

Platform Flexibility: Your place or ours! RudderStack provides dedicated VPC as well as open-source (run on your own) versions in addition to our secure Cloud option.

Price

We don’t charge for MTU’s. Our flexible, volume based pricing is predictable and designed to scale with you.

Warehouse flexibility

It’s your data. Host it wherever you want, and we’ll bring the data to you.

Switch with minimal engineering work and no data loss

Now that we’ve made our case, let’s walk you through the basics of switching from Segment to RudderStack. If you haven’t already, go ahead and sign up for a free hosted instance on our website.

Step 1: Setting Up RudderStack

Once you have set up your account on RudderStack, you are just a few steps away from migrating to RudderStack. Our goal here is to lay out the steps necessary to replace your instrumentation code for generating events from using the Segment SDK to the RudderStack SDK with minimal changes.

NOTE: You can also check out our guide on how to add sources and destinations in RudderStack.

Start with creating an account on the RudderStack dashboard. Similar to Segment, you will create sources and destinations here. This will help you create the necessary connections for the event data to flow from your sources to the destination.

RudderStack requires a data plane for the events to flow through. You can set it up yourself within your cloud computing environment, or you can have us host it within our VPC. To set it up yourself, check our installation guide.

If you need more support or want us to manage your hosting, please feel free to contact us.

Step 2: Updating SDK implementation

In this example, we will highlight adding the JavaScript SDK for your existing websites. For iOS and Android sample code, see our documentation on Migrating From Segment To RudderStack:

HTML
<script>
rudderanalytics = window.rudderanalytics = [];
var methods = [
"load",
"page",
"track",
"identify",
"alias",
"group",
"ready",
"reset",
"getAnonymousId",
"setAnonymousId",
"getUserId",
"getUserTraits",
"getGroupId",
"getGroupTraits"
];
for (var i = 0; i < methods.length; i++) {
var method = methods[i];
rudderanalytics[method] = (function (methodName) {
return function () {
rudderanalytics.push(
[methodName].concat(Array.prototype.slice.call(arguments))
);
};
})(method);
}
rudderanalytics.load(WRITE_KEY,DATA_PLANE_URL);
rudderanalytics.page();
</script>
<script src="https://cdn.rudderlabs.com/v1.1/rudder-analytics.min.js"></script>
rudderanalytics.load(<YOUR_WRITE_KEY>, <DATA_PLANE_URI>);
rudderanalytics.page();
</script>
<script src="https://cdn.rudderlabs.com/v1.1/rudder-analytics.min.js"></script>

Note the change to the object. We use rudderanalytics as the global object library in comparison to Segment's analytics object. From here on out, you can use the rest of your code as is, as the RudderStack SDK is fully API-compatible with Segment

The only thing left to do is create your destinations within the RudderStack app. For a quick video tutorial, check out Sending Data Using RudderStack In Under 5 Minutes

Step 3: Migrating (not) your warehouse schemas

A major advantage of switching from Segment to RudderStack is the ability to store all of your event and user data in your own warehouse.  Migrating your data warehouse destinations from Segment to RudderStack is fairly straightforward as RudderStack can leverage the existing schemas you’ve already created as storage destinations within Segment.  This ensures no historical data will be lost as the event sources are switched; in other words you do not have to migrate data!

At this point you will want to disconnect your warehouse destination in Segment. Otherwise duplicate events will be created in your data warehouse.

Because RudderStack writes to the same schema(s) as Segment, you can move your warehouse destinations over to RudderStack with no interruption in warehouse loads. RudderStack will structure tables, columns and data types in the exact same way that segment does.

If you would like to validate before connecting directly to RudderStack, you can optionally relay your segment data to your warehouse via RudderStack to confirm the matching schemas by using Segment as a source.

Step 4: Backfilling anonymous IDs from Segment

When migrating from Segment, you likely already have some amount of anonymous traffic that has not yet been identified. When Segment or RudderStack track events for non-identified users, both assign a random UUID as an anonymousId. This ID is used to track an unknown user until they are identified and allows us to stitch together user behavior, journeys, and first touch attribution before and after they are identified.

To ensure that users are not assigned new anonymous id’s (and therefore double counted) by the RudderStack SDK, you can choose to automatically capture the existing Segment anonymous id from local storage or Segment cookies (see snippet below). In the case that Segment has already assigned an id, RudderStack will set that as the user’s anonymous id which ensures that user journeys will be stitched without duplication or data loss.

HTML
{
autoCapture: {
enabled: true,
source: "segment",
}
}

Advanced options

If you leverage Segment’s Personas and User Traits features, stay tuned for part two and part three of this series where we’ll detail how RudderStack supports identity resolution, SQL Traits and building and distributing custom audiences using dbt and RudderStack Warehouse Actions!

Ready to start migrating?

Sign up for free today to test out our event stream, ELT, and reverse-ETL pipelines. Use our HTTP source to send data in less than 5 minutes, or install one of our 12 SDKs in your website or app. Get started.

August 10, 2021