Ninetailed
Search
K

Segment Plugin

Sending data downstream to Twilio Segment - the leading customer data platform.
Segment has built-in tools for analytics, personalization, and more. It integrates with popular tools like Google Analytics or Salesforce, making it easy to get data into your stack without writing code. Ninetailed's SDK can send data directly to Segment.

Installation

To set up Ninetailed to send data, you must install the @ninetailed/experience.js-plugin-segment plugin
npm
yarn
npm install @ninetailed/experience.js-plugin-segment
yarn add @ninetailed/experience.js-plugin-segment
To use the Segment plugin, you need to import the following code into your code
import segment from '@analytics/segment';
Then initialize the plugin.
React
Next
Gatsby
<NinetailedProvider
plugins={[
new NinetailedSegmentPlugin({
writeKey:PUBLIC_SEGMENT_KEY ?? '',
actionTemplate: 'Has Seen Component - Audience:{{Audience.id}}',
componentPropertyTemplate:'{{ component.id }}',
audiencePropertyTemplate:'{{ audience.id }}',
})
]}
>
//... Your Application Components
</NinetailedProvider>
<NinetailedProvider
plugins={[
new NinetailedSegmentPlugin({
writeKey:PUBLIC_SEGMENT_KEY ?? '',
actionTemplate: 'Has Seen Component - Audience:{{Audience.id}}',
componentPropertyTemplate:'{{ component.id }}',
audiencePropertyTemplate:'{{ audience.id }}',
})
]}
>
//... Your Application Components
</NinetailedProvider>
plugins: [
// ...
{
resolve: `@ninetailed/experience.js-gatsby`,
options: {
clientId: PUBLIC_NINETAILED_CLIENT_ID,
environment: PUBLIC_NINETAILED_ENVIRONMENT,
ninetailedPlugins: [
{
resolve: `@ninetailed/experience.js-plugin-segment`,
options: {
writeKey: PUBLIC_SEGMENT_KEY ?? '',
actionTemplate: 'Has Seen Component - Audience:{{Audience.id}}',
componentPropertyTemplate:'{{ component.id }}',
audiencePropertyTemplate:'{{ audience.id }}',
}
}
]
}
}
]
The experience.js segment plugin utilizes the track API, which records all actions your user performs along with the properties that describe the action performed by the user.
Each action is called an event, and these events have names and properties. The properties can be defined by you, and it is optional but if you need to get a clearer picture of the user, it is important.of
{
"type": "track",
"event": "User Registered",
"properties": {}
}
Furthermore, the categoryPropertyTemplate is a templated optional property that can be attached to the event to give a clearer picture of what component is viewed or the event took place on your interface.
The audienceProperty is also a templated optional property that adds further information about the audience for the personalized component,
Segment is also a source of customer data. Have a look at the Customer Data section to learn more about how to leverage your data from Segment within Ninetailed.