Skip to contentSkip to navigationSkip to topbar
On this page
Looking for more inspiration?Visit the
(information)
You're in the right place! Segment documentation is now part of Twilio Docs. The content you are used to is still here—just in a new home with a refreshed look.

Swrve Destination


Destination Info
  • Accepts Page, Identify and Track calls.
  • In Device-mode, refer to it as swrve in the Integrations object
Connection Modes
Device-modeCloud-mode
Web Web
Mobile Mobile
Server Server

Getting Started

getting-started page anchor

Once the Segment library is integrated, toggle Swrve on in your Segment destination catalog. You can integrate Swrve as a mobile destination (iOS or Android). You'll need to get your app_id and api_key from the Swrve dashboard and add these to your mobile app.

Swrve supports the identify, track and screen methods.


Integrating

integrating page anchor
  1. In your top-level project build.gradle add:
1
repositories {
2
jcenter{
3
url = 'http://dl.bintray.com/swrve-inc/android'
4
}
5
maven {
6
url = 'https://maven.google.com'
7
}
8
}
  1. Add the Swrve Segment dependency to your app build.gradle:
compile 'com.swrve:swrve-segment-integration:+'
  1. To do this, import the Swrve integration:
import com.segment.analytics.android.integrations.swrve.SwrveIntegration;

And add the following lines when initializing Segment:

1
int appId = -1;
2
String apiKey = "api_key";
3
4
SwrveConfig swrveConfig = new SwrveConfig();
5
// To use the EU stack, include this in your config.
6
// swrveConfig.setSelectedStack(SwrveStack.EU);
7
8
Analytics analytics = new Analytics.Builder(this, "write_key")
9
.use(SwrveIntegration.createFactory(application, appId, apiKey, swrveConfig)
10
.build();

Note: Since Swrve needs to be initialized as early as possible, you need to supply the app_id and api_key key when you initialize the factory that is registered with the analytics client.

Integrating Push & A/B Testing

integrating-push--ab-testing page anchor

Follow Swrve's push notification documentation(link takes you to an external page).

Integrating In-app Messaging & Conversations

integrating-in-app-messaging--conversations page anchor

No further action is required to integrate in-app messages or Conversations, which are registered for and requested by default by our Swrve Segment destination.


  1. Add this line to your Podfile:
pod 'Segment-Swrve'
  1. Register the integration. To do this, import the Swrve integration in your AppDelegate:
#import <SwrveSegment/SEGSwrveIntegrationFactory.h>

And add the following lines:

1
NSString *const SEGMENT_WRITE_KEY = @"...";
2
SEGAnalyticsConfiguration *config = [SEGAnalyticsConfiguration configurationWithWriteKey:SEGMENT_WRITE_KEY];
3
4
// FIXME Add your own App ID and Api Key here
5
int appId = 0;
6
NSString *apiKey =@"<Enter your own Api key here>";
7
8
SwrveConfig *swrveConfig = [[SwrveConfig alloc] init];
9
10
// TODO:
11
// To use the EU stack, include this in your config.
12
// swrveConfig.selectedStack = SWRVE_STACK_EU;
13
14
[config use:[SEGSwrveIntegrationFactory instanceWithAppId:appId
15
apiKey:apiKey
16
swrveConfig:swrveConfig
17
launchOptions:launchOptions]];
18
19
[SEGAnalytics setupWithConfiguration:config];

Note: Since Swrve needs to be initialized as early as possible, you need to supply the app_id and api_key key when you initialize the factory that is registered with the analytics client.

Integrating Push & A/B Testing

integrating-push--ab-testing-1 page anchor

Follow Swrve's push notification documentation(link takes you to an external page).

Integrating In-app Messaging & Conversations

integrating-in-app-messaging--conversations-1 page anchor

No further action is required to integrate in-app messages or Conversations, which are registered for and requested by default by our Swrve Segment destination.


When you call screen in your mobile app, we send a event prefixed with screen. to Swrve.


When you identify a user, we'll pass that userId as a user property named customer.id to Swrve.

All other traits will be sent to Swrve as custom user properties. Traits will be converted to strings before sending to Swrve.


When you track an event, we will send that event directly to Swrve as a custom event. Event properties will be sent to Swrve as event payloads. Properties will be converted to strings before sending.


Segment lets you change these destination settings from the Segment app without having to touch any code.

Property nameTypeRequiredDescription
Do not remove settingstring

Optional

Android requires at least one setting