Keen Destination


Getting Started

When you toggle on Keen in Segment, this is what happens:

  • Our CDN is updated within 45 minutes. Then our snippet will start asynchronously loading keen.js onto your page. This means you should remove Keen’s snippet from your page.
  • Since Keen only records custom events and custom user data, no events or users will appear in Keen until you start using the API outlined below.

Keen is supported on the client side and server side.


Identify

Client-Side

When you call identify on analytics.js, we call Keen’s setGlobalProperties and set the user field with userId and traits.

Note: To see this information inside Keen, you must make track call as the userId and traits are simply cached on the client. Your subsequent track calls will be appended with the userId and traits.

Server-Side

On the server-side, calling identify has no effect on Keen.

Track

Client-Side

When you call track or one of its helpers functions on analytics.js, we call Keen’s addEvent with exactly the same parameters.

Server-Side

When you call track on on the server-side, we route the event to Keen.

If you make the following Segment call using any of the server-side sources,

analytics.track('user@example.com', 'Purchased', {
    item: 'T-Shirt',
    revenue: 19.99
});

We will forward the following to Keen:

  • Event Collection: Purchased
  • Event Properties:
    {
      userId: 'user@example.com'
      item: 'T-Shirt',
      revenue: 19.99
    }
    

Personas

You can send computed traits and audiences generated through Segment Personas to this destination as a user property. To learn more about Personas, reach out for a demo.

For user-property destinations, an identify call will be sent to the destination for each user being added and removed. The property name will be the snake_cased version of the audience name you provide with a true/false value. For example, when a user first completes an order in the last 30 days, we will send an identify call with the property order_completed_last_30days: true, and when this user no longer satisfies we will set that value to false.

When the audience is first created an identify call is sent for every user in the audience. Subsequent syncs will only send updates for those users which were added or removed since the last sync.

Supported Sources and Connection Modes

The first step is to make sure Keen supports the source type and connection mode you’ve chosen to implement. You can learn more about what dictates the connection modes we support here.

Web Mobile Server
📱 Device-mode
☁️ Cloud-mode

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

We offer an optional Cloud-based Connection Mode for Web data with Keen. As a reminder, this removes the Keen javascript library from your site, improving performance.

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

Settings

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

Geo IP Addon

Enable this to use Keen’s data enrichment feature to add geographic information based on IP.

Project ID

Your project ID. It should be 24 characters long, and look something like this: 9181bcd23843312d87000000.

Read Key

If you are a Keen Pro user, enter your read key in the advanced settings tab of your dashboard. It should be a minimum of 32 characters long and made up of numbers and letters only.

Referrer Parsing Addon

Enable this to use the Keen IO’s data enrichment feature for parsing referrer URLs into their source.

Track All Pages to Keen

This will track Loaded a Page events to Keen for all page method calls.

Track Categorized Pages to Keen

This will track events to Keen for page method calls that have a category associated with them. For example page('Docs', 'Index') would translate to Viewed Docs Page.

Track Named Pages to Keen

This will track events to Keen for page method calls that have a name associated with them. For example page('Signup') would translate to Viewed Signup Page.

Track an Initial Pageview

This will send an intial ‘Loaded a Page’ event to Keen when the page is loaded. We disable this by default since Keen is generally used for custom event tracking, not pageviews. Note: you must also have the Send Pageview Events setting enabled for this to work.

URL Parsing Addon

Enable this to use the Keen’s data enrichment feature for parsing URLs into its components for easier filtering. Note that userAgent is only collected on Android, not on iOS.

UserAgent Addon

Enable this to use the Keen’s data enrichment to parse UserAgent strings.

Write Key

Your write key should be a minimum of 32 characters long and made up of numbers and letters only.

Adding Keen to the integrations object

To add Keen to the integrations JSON object (for example, to filter data from a specific source), use one of the following valid names for this integration:

  • Keen IO

  • Keen

This page was last modified: 04 Feb 2020

Get started with Segment

Segment is the easiest way to integrate your websites & mobile apps data to over 300 analytics and growth tools.
or
Create free account