What is Segment

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.
The Ninetailed SDK sends data to Segment and this data can be sent to analytics tools for analysis to help marketers decide what decision to make to increase return.

What is Source

A source is a website, cloud application, or mobile app where data or events from users can be sent from. Segment also offers an analytics platform that makes it easy to track, analyze, and visualize customer data.
Furthermore, Ninetailed SDK handles sending your platform data to Segment where you can utilize analytic tools or some advertising tools.

Getting Started

To set up Ninetailed to send data, you must install the @ninetailed/experience.js-plugin-segment plugin
//Install using npm
npm install @ninetailed/experience.js-plugin-segment
Install using yarn
yarn add @ninetailed/experience.js-plugin-segment

How to Use

To use the Segment plugin, you need to import the following code into your code
import segment from '@analytics/segment';
Then initialize the plugin with NinetailedProvider
// ...
new NinetailedSegmentPlugin({
writeKey:PUBLIC_SEGMENT_KEY ?? '',
actionTemplate: 'Has Seen Component - Audience:{{}}',
componentPropertyTemplate:'{{ }}',
audiencePropertyTemplate:'{{ }}',
//... Your Application Components
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.
"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,

What’s Next

Segment is as well a customer data platform (CDP). Combine data from multiple sources or tools containing data on all touch points and interactions with your product or service. To use this, you can check the Customer data section for more.