A simple library for track listeners & events for Segment.io
npm install @out-fund/segment-eventsA collection of event listeners and triggers for use with segment io.
To learn more about segment io please visit the docs: https://segment.com/docs/
To install run npm install @outfund/segment or yarn add @outfund/segment
import { initSegment, track } from "@outfund/segment
coming soon 🕰
The initSegment function requires your Segment ID key which you can get from your account.initSegment(id: string)
const segmentKey = 'abc123' initSegment(segmentKey)
import {track} from '@outfund/segment'
Page Views:track.page(pageName: string, regions: string[], platform: string );
track.page('Homepage' ['uk','de', 'us' 'es'], 'website' )
Element Clicked: clicks(selector: string, regions: string[], platform: string)
Option Selected: optionSelected(selector: string, regions: string[], platform: string)
Text Entered: textEntered(selector: string, regions: string[], platform: string)
Custom Event: customEvent(eventName: string, data: any)
[data-trait=""]: Fires an identifyer for the event, name the triat you want to track and the value will be the name of the event.
[element-name=""]: This will be the name of the event, useful for grouping events, or if you want custom names for event triggers
[element-type=""]: The type of element i.e button, hyperlink etc.
[data-surface-type=""] Used for the type of surface the event is being fired on, i.e hero, footer, modal, etc.
[data-surface-title=""]: The title of the surface the event is being fired on. Not required but useful in some cases.
[element-state=""]: Used for defining the state of an element, i.e. active, inactive, open, closed etc.
- [ ] Automatically pass the region/country in track events
- [ ] Events for Toggles, Modals & Video played
- [ ] Custom Page Names