Skip to contentSkip to navigationSkip to topbar
Page toolsOn this page
Looking for more inspiration?Visit the

UrbanAirship Destination


The Urban Airship destination code is open sourced on GitHub. Feel free to check it out: Android(link takes you to an external page), iOS(link takes you to an external page)


Screen

screen page anchor

Screen calls will generate Urban Airship screen tracking events. These events are exposed through Connect. Only the screen and category name will be used as the screen tracking event name.


When you identify a user, Urban Airship will use the userId to set the Named User(link takes you to an external page). Named Users allow you to associate multiple devices to a single user or profile that may be associated with more than one device, e.g., an end-user's Android phone and tablet. A device can have only one Named User, and a single Named User should not be associated with more than 20 devices.


When track is called, an Urban Airship custom event will be created. The event's traits will will be automatically added as properties on the custom event and if revenue is present that will be set at the custom event's value.


Groups will be added as tags on the Urban Airship channel. Tags can then be used for audience segmentation when sending notifications or setting up automation rules.


Setup

setup page anchor
  1. Include the Urban Airship dependency in the project's build.gradle file:
1
repositories {
2
...
3
4
maven {
5
url "https://urbanairship.bintray.com/android"
6
}
7
}
8
9
10
dependencies {
11
...
12
13
// Urban Airship SDK
14
compile 'com.urbanairship.android:segment-integration:1.0.+'
15
}
  1. Verify the applicationId is set in the project's build.gradle file:
1
android {
2
...
3
4
defaultConfig {
5
...
6
7
applicationId "com.example.application"
8
}
9
}
  1. Add the Urban Airship Destination factory:
1
Analytics analytics = new Analytics.Builder(context, writeKey)
2
.use(UrbanAirshipIntegration.FACTORY)
3
...
4
.build();

Enabling user notifications

enabling-user-notifications page anchor

Once the Urban Airship destination is ready, you can enable user notifications with the following:

1
analytics.onIntegrationReady(UrbanAirshipIntegration.URBAN_AIRSHIP_KEY, new Analytics.Callback<Object>() {
2
@Override
3
public void onReady(Object instance) {
4
UAirship airship = (UAirship) instance;
5
airship.getPushManager().setUserNotificationsEnabled(true);
6
}
7
});

  1. Add the Urban Airship Segment Destination pod to your project's Podfile:
pod "UrbanAirship-iOS-Segment-Integration"
  1. Use the Urban Airship Destination:
1
SEGAnalyticsConfiguration *config = [SEGAnalyticsConfiguration configurationWithWriteKey:@"YOUR_WRITE_KEY"];
2
3
[config use:[SEGUrbanAirshipIntegrationFactory instance]];
4
5
[SEGAnalytics setupWithConfiguration:config];

Once the Urban Airship destination is ready, you can enable user notifications with the following:

[UAirship push].userPushNotificationsEnabled = YES;

To listen for when the Urban Airship destination is ready, listen for the SEGAnalyticsIntegrationDidStart event in NSNotificationCenter:

1
[[[NSNotificationCenter defaultCenter] addObserver:self
2
selector:@selector(airshipReady)
3
name:@"io.segment.analytics.integration.did.start"
4
object:[SEGUrbanAirshipIntegrationFactory instance].key];