Kahuna Destination

Segment makes it easy to send your data to Kahuna (and lots of other destinations). Once you've tracked your data through our open source libraries we'll translate and route your data to Kahuna in the format they understand. Learn more about how to use Kahuna with Segment.

Getting Started

Segment makes it easy to send your data to Kahuna. Once you’re tracking data through our iOS, Android or server side libraries, we’ll translate and route your data to Kahuna in the format they can process.

If you have mobile apps, then Kahuna recommends using the Segment iOS and or Android library and bundling Kahuna (see Mobile section below).

If you are sending data from a server side library, please read the Server side section.

Be sure to enable Kahuna in your Segment destinations page and provide your Kahuna Secret Key, which can be found in the Settings page of the Kahuna Dashboard.

Mobile

In order to leverage the full capability of Kahuna’s Push Messaging and In-App features, you will have to bundle the Kahuna SDK while configuring your Segment mobile SDKs.

Android

Add this to your project gradle file:

allprojects {
  repositories {
    jcenter()
    maven { url "https://kahuna.github.io/kahuna-android/integration" }
    maven { url "https://kahuna.github.ios/kahuna-android/sdk" }
  }
}

Add this to your app level gradle file:

compile ('com.kahuna.integration.android.segment:kahuna:+') {
  transitive = true
}

Then, bundle Kahuna during your Segment Analytics initialization, with more details here:

Analytics analytics = new Analytics.Builder(this, "SEGMENT_KEY")
  .use(KahunaIntegration.FACTORY)
  .build();

iOS

Add the Kahuna pod dependency:

pod "Segment-Kahuna

Then, bundle Kahuna during your Segment Analytics initialization, with more details here:

#import <Segment-Kahuna/SEGKahunaIntegrationFactory.h>
SEGAnalyticsConfiguration *config = [SEGAnalyticsConfiguration configurationWithWriteKey:@"YOUR_WRITE_KEY"];

[config use:[SEGKahunaIntegrationFactory instance]];

[SEGAnalytics setupWithConfiguration:config];

Push Notifications

To leverage the Push Notifications and In-App functionality provided by Kahuna, follow the steps in the Kahuna SDK destination guide:

Reset

If your app supports the ability for a user to logout and login with a new identity, then you’ll need to call reset in your mobile app. Here we will call Kahuna’s logout implementation to ensure the user information remains consistent.

Server-Side

If you are using Segment’s iOS or Android libraries but have not bundled Kahuna’s SDK as described in the mobile section above, we will default to using the server side destination. It is recommended that you bundle the Kahuna’s SDK in order to use features such as Push Notifications and In-App features.

However, any data coming from sources other than mobile apps should be using the server side destination.

Batching

If you are using the server side destination for Kahuna, we recommend you set the Segment batching options as follows (note: these settings would apply to all of your Segment destinations):

  • flushAt to 100
  • flushAfter to 30 minutes (or 1800000 ms)

Identify

Our server-side destination supports the ability to register user information with Kahuna through our identify calls. This will allow you to organize and segment your Kahuna campaigns according to the user information that you have sent.

The first thing you’ll want to do is to identify a user with any relevant information as soon as they launch the app. You record this with our identify method.

Identify takes the userId of a user and any traits you know about them.

When you call identify, we’ll set two Kahuna Credentials, user_id and email. Any other traits will instead be sent to Kahuna as user_info, which are User Attributes in Kahuna.

We will also send any relevant device information such as device token, app name and version, OS and browser name, etc.

Track

You can also use track calls to send event data using Kahuna’s Intelligent Events.

Whenever you call track, we’ll send an event to Kahuna with the event name and a unix timestamp. We will also pass through any properties of the event. If properties.quantity and properties.revenue are set, then we will send the event name as well as count and value. For value, we will first multiply properties.revenue by 100 before sending to Kahuna since Kahuna tracks value in cents not dollars.

Note: We will flatten any compound objects such as nested objects or arrays. We will also strip any properties that have values of null since Kahuna’s API does not support these values. Lastly, just like the identify call, we will send any relevant device parameters we can send based off the context of the call.

Screen

When you call screen in your mobile app, we send a screen view to Kahuna for mobile apps if trackAllPages is enabled for your Kahuna destination. If enabled, we track a Kahuna event with the format “Viewed screen.name Screen”. If you want to enable sending screenevents to Kahuna, simply check the box for: Track All Pages from your Segment Kahuna settings page.

E-Commerce

Segment supports a deeper Kahuna destination with e-commerce tracking in our mobile SDKs (NOT in server side). All you have to do is adhere to our e-commerce tracking API and we’ll track Kahuna e-commerce specific user attributes.

Viewed Product Category

For Viewed Product Category, we will track the Kahuna User Attributes “Last Viewed Category” and “Categories Viewed”. The value for Last Viewed Category will be taken from properties.category, “None” if unspecified. The value of Categories Viewed will be a list of the last 50 unique categories the user viewed, also taken from properties.category.

Viewed Product

For Viewed Product, we will track the same Kahuna User Attributes as Viewed Product Category. We also will track another User Attribute called “Last Product Viewed Name” with the value taken from properties.name.

Added Product

For Added Product, we will track the Kahuna User Attributes “Last Product Added To Cart Name” taken from properties.name and “Last Product Added To Cart Category” taken from properties.category. If category is unspecified, we will track “None”.

Completed Order

For Completed Order, we will track the Kahuna User Attributes “Last Purchase Discount” taken from properties.discount. If discount is unspecified, we will track 0.

Send Push Token via Server-Side

If you chose not to bundle the Kahuna Mobile SDK, then you will have to implement your own Push Message processors, and you won’t have access to Kahuna’s In-App feature.

If you decide to implement your own Push Message processors, then make sure you pass the Push Tokens to Kahuna via Server Side. You can do this by sending it inside context.device.token. We will send this to Kahuna as push_token.


Supported Sources and Connection Modes

WebMobileServer
📱 Device-based
☁️ Cloud-based

To learn more about about Connection Modes and what dictates which we support, see here.

Segment offers an optional Device-based Connection Mode for Mobile data with Kahuna. If you’d like to use those features that require client-based functionality, follow the steps above to ensure you have packaged the Kahuna SDK with Segment’s.

Settings

Segment lets you change these destination settings via your Segment dashboard without having to touch any code.

Secret Key

Specify the Secret Key from Kahuna (located in Kahuna’s dashboard’s settings).

Send data to production environment (default sandbox)

Check to send data to production account (default sandbox) once you are ready to pass data to Kahuna’s production namespace

Sender ID / Google API Project Number

If you are using our older mobile library (before v2 iOS or v3 Android) and have packaged Kahuna’s SDK, you can give us the sender ID. The sender ID is also called the project number in your Google API project. Make sure you have created a project by following instructions here, under ‘Enable Personalized Push’


If you have any questions or see anywhere we can improve our documentation, please let us know or kick off a conversation in the Segment Community!