Skip to content

fabrix-app/spool-segment

Repository files navigation

spool-segment

Gitter NPM version Build Status Test Coverage Dependency Status Follow @FabrixApp on Twitter

📦 Segment Spool

Implements Segment as a Fabrix spool

Analytics.js

This spool watches the segment flush property and will emit a fabrix event (spool:segment:flushed) when a flush happens. It will also flush the segment que when unloaded to prevent data loss.

Install

$ npm install --save @fabrix/spool-segment

Configure

// config/main.ts
import { SegmentSpool } from '@fabrix/spool-segment'
export const main = {
  spools: [
    // ... other spools
    SegmentSpool
  ]
}

Configuration

 // config/segment.ts
export const segment = {
  write_key: '<YOUR WRITE KEY>',
  flush_at: 1,
  flush_interval: 1000
}

For more information about segment (type and configuration) please see the segment documentation.

Usage

const data = {...}

// You can use the extension directly...
this.app.segment.track(data)

// Or as a Promise from the SegmentService...
return this.app.services.SegmentService.track(data)

SegmentService Methods

Identify

Track

Page

Group

Alias

Flush

About

Spool - Add Segment.io easily to Fabrix app

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published