This document covers the steps required to migrate from Snowplow to RudderStack and replace your instrumentation code. You can then start using the RudderStack SDKs to track your events with minimal code changes.
Set up the source-destination connections in the dashboard to facilitate event data flow. For more information on setting up connections, refer to the Quickstart guide.
Depending on your target platform, follow these steps to move your existing Snowplow SDK implementation to RudderStack.
Android
RudderStack distributes the Rudder Snowplow adapter SDK through Maven Central. We recommended you add the SDK to your project through the Android Gradle build system.
Add the following code in your project level app/build.gradle file:
Update your SDK initialization to any one of the following snippet (method 1, 2, or 3 in the following snippets). Also, replace the WRITE_KEY and DATA_PLANE_URL with your source write key and data plane URL obtained in the above section.
//Method 1: Default values are considered for all configuration objects
//except networkConfiguration.
RSTrackertracker=newRSTracker().createTracker(this,WRITE_KEY,networkConfiguration);//Method 2: Default values are considered for all configuration objects.
RSTrackertracker=newRSTracker().createTracker(this,WRITE_KEY,DATA_PLANE_URL);//Method 3: Values for all configuration objects must be provided.
RSTrackertracker=newRSTracker().createTracker(this,WRITE_KEY,networkConfiguration,sessionConfiguration,trackerConfiguration,subjectConfiguration);
//Method 1: Default values are considered for all configuration objects
//except networkConfiguration.
valtracker=RSTracker().createTracker(this,WRITE_KEY,networkConfiguration)//Method 2: Default values are considered for all configuration objects.
valtracker=RSTracker().createTracker(this,WRITE_KEY,DATA_PLANE_URL)//Method 3: Values for all configuration objects must be provided.
valtracker=RSTracker().createTracker(this,WRITE_KEY,networkConfiguration,sessionConfiguration,trackerConfiguration,subjectConfiguration)
Follow these steps to migrate to the RudderStack iOS SDK:
Add the SDK to your Podfile:
pod'RudderSnowplowMigrator','1.0.0.beta.1'
Run the following command:
podinstall
Add the following code in all .m and .h files (for Objective-C) or .swift files(for Swift) where you want to refer or use RudderStack SDK classes:
@importRudderSnowplowMigrator;
importRudderSnowplowMigrator
Update your SDK initialization to any one of the following snippet (method 1, 2, or 3). Also, replace the WRITE_KEY and DATA_PLANE_URL with your source write key and data plane URL obtained in the above section.
//Method 1: Default values are considered for all configuration objects
//except networkConfiguration.
RSTracker*tracker=[RSTrackercreateTrackerWithWriteKey:WRITE_KEYnetwork:networkConfig];//Method 2: Default values are considered for all configuration objects.
RSTracker*tracker=[RSTrackercreateTrackerWithWriteKey:WRITE_KEYdataPlaneUrl:DATA_PLANE_URL];//Method 3: Values for all configuration objects must be provided.
RSTracker*tracker=[RSTrackercreateTrackerWithWriteKey:WRITE_KEYnetwork:networkConfigconfigurations:@[trackerConfig]];
//Method 1: Default values are considered for all configuration objects //except networkConfiguration.lettracker=RSTracker.createTracker(writeKey:WRITE_KEY,network:networkConfig)//Method 2: Default values are considered for all configuration objects.lettracker=RSTracker.createTracker(writeKey:WRITE_KEY,dataPlaneUrl:DATA_PLANE_URL)//Method 3: Values for all configuration objects must be provided.lettracker=RSTracker.createTracker(writeKey:WRITE_KEY,network:networkConfig,configurations:[trackerConfig,sessionConfig])
To migrate to the RudderStack JavaScript SDK, add the following code snippet in the <head> section of your website. Also, replace the WRITE_KEY and DATA_PLANE_URL with your source write key and data plane URL obtained in the above section.
<script>rs=window.rs=[],rs.snoplowAdapter=function(){rs.push(Array.prototype.slice.call(arguments))},rs.snoplowAdapter("newTracker",<WRITE_KEY>,<DATA_PLANE_URL>,{<Configurations>});//Optionally, use RudderStack JavaScript SDK load options
rudderanalytics.load();</script><scriptsrc="https://cdn.rudderlabs.com/adapter/sp/beta/v1/rs-sp-analytics.min.js"></script>
The <Configurations> parameter in the above snippet can be replaced by the following Snowplow properties which are mapped to the RudderStack properties as shown:
Snowplow property
RudderStack property
cookieDomain
setCookieDomain
cookieSameSite
sameSiteCookie
cookieSecure
secureCookie
Setting configuration objects for mobile SDKs
RudderStack supports setting values for the following Snowplow configuration objects in the mobile SDKs (iOS/Android). If not set, the default values are assigned.
If not set, the default values for dataPlaneUrl and controlPlaneUrl are taken as https://hosted.rudderlabs.com and https://api.rudderlabs.com respectively.
SessionConfiguration
The SessionConfiguration class can be used to capture sessions to track the user activity in the app:
You need to pass both the arguments for the SessionConfiguration class as shown in the previous code snippets. However, RudderStack ignores the first argument (as it is a placeholder argument) and considers only the second argument (backgroundTimeout).
For mobile SDKs, Snowplow’s default timeout session is 30 minutes whereas RudderStack’s default timeout session is 5 minutes. Refer to the RudderStack Session Tracking documentation for more information.
TrackerConfiguration
The TrackerConfiguration class can be used to configure contexts and automatic events of the tracker and the general behavior, as shown in the following snippets:
Snowplow automatically captures and tracks the following data. Refer to the Auto-tracked events and entities section for more information.
Variable name
Default value
logLevel
LogLevel.OFF
lifecycleAutotracking
true
screenViewAutotracking
true
sessionContext
true
RudderStack ignores any variable other than the ones mentioned above.
SubjectConfiguration
The SubjectConfiguration class can be used to capture basic user information which is attached to all events as the context entity.
Snowplow does not provide any call to identify a user. However, RudderStack sends an call if you initialize the SubjectConfiguration class while initializing the SDK. Note that a user is not identified if the SDK is not initialized.
The userId field is mapped to the RudderStack’s userId. All the other properties are mapped to RudderStack’s traits object.
userId is a mandatory field. If not provided, the identify call is ignored.
Snowplow supports identifying a user by passing the setUserId method. A Snowplow event including the setUserId method triggers the identify call in the RudderStack JavaScript SDK.
RudderStack sends a track call for Snowplow events containing the Structured class.
In the following example, RudderStack maps Action_example to the RudderStack event name and the rest of the properties like Category_example, label, value, etc. to the RudderStack properties.
This is not a default application lifecycle event. Hence, the properties like version, build, etc. are not present under properties.
Custom background events
RudderStack sends a track call for Snowplow events containing the Background class.
RudderStack sends the event name as Application Backgrounded and maps the rest of the properties, like index, properties, etc. to the RudderStack properties.
This is not a default application lifecycle event. Hence, the properties like version, build, etc. are not present under properties.
JavaScript
The RudderStack JavaScript SDK supports Snowplow’s trackStructEvent and trackSelfDescribingEvent calls. These Snowplow calls capture user events along with their associated properties and trigger the track call in the RudderStack JavaScript SDK.
In the previous code snippet, the trackSelfDescribingEvent method tracks the Order Completed event along with other information like revenue, currency, and user_actual_id, etc.
In the previous code snippet, the trackStructEvent method tracks the Order Completed event along with other information like label, property, and value, etc.
The action field is mandatory in both calls.
Tracking page or screen views
iOS/Android
Snowplow’s ScreenView class captures whenever a new screen is loaded. A Snowplow event including the ScreenView class triggers the screen call in the RudderStack iOS or Android SDK.
RudderStack maps the name property to RudderStack event name and the rest of the properties, like screenId, previousName, previousId, etc. to the RudderStack properties.
Snowplow’s trackPageView call lets you record your website’s page views with any additional relevant information about the viewed page. A Snowplow event including the trackPageView call triggers the screen call in the RudderStack JavaScript SDK.
A sample trackPageView call:
rs.snowplowAdapter('trackPageView',{title:'Cart Viewed',},{path:'/best-seller/1',referrer:'https://www.google.com/search?q=estore+bestseller',search:'estore bestseller',title:'The best sellers offered by EStore',url:'https://www.estore.com/best-seller/1',},);
In the previous code snippet, the SDK captures the page title and other contextual information.
This site uses cookies to improve your experience while you navigate through the website. Out of
these
cookies, the cookies that are categorized as necessary are stored on your browser as they are as
essential
for the working of basic functionalities of the website. We also use third-party cookies that
help
us
analyze and understand how you use this website. These cookies will be stored in your browser
only
with
your
consent. You also have the option to opt-out of these cookies. But opting out of some of these
cookies
may
have an effect on your browsing experience.
Necessary
Always Enabled
Necessary cookies are absolutely essential for the website to function properly. This
category only includes cookies that ensures basic functionalities and security
features of the website. These cookies do not store any personal information.
This site uses cookies to improve your experience. If you want to
learn more about cookies and why we use them, visit our cookie
policy. We'll assume you're ok with this, but you can opt-out if you wish Cookie Settings.