segment-wrapper

1.2.5-alpha.2 • Public • Published

Segment Wrapper

This package provides a way of using Segment in a safe and secure way.

Getting started

$ yarn add @bulb/segment-wrapper

Using the wrapper

The wrapper replaces any use of Segment's .track, .page and .identify functions.

You can then you can use the normal Segment functions:

const adsTracker = new Tracker(adsOptions);

adsTracker.track('Clickable Clicked', { button: 'Switch Now' });

Integration options

You can specify the integrations either when constructing the instance of the tracker, or for a particular track/page/identify event. Integrations determine to which destination the events are sent to.

The package provides 2 preset integrations options:

  1. DataWarehousing options This is for internal tracking destinations, including BigQuery and Google Pub Sub

  2. Ads options This is for sharing events with third parties and ad partners, including Facebook Pixel and Google Ads.

You can also set custom integrations, however the flag All will always be reset to false to prevent the event going to all destinations.

You can construct the tracker with a preset set of integrations, but change the integrations for a particular event. In the below example, the event will still be sent to the other datawarehousing destinations Google Analytics and Google Cloud PubSub.

const dwTracker = new Tracker(dataWarehousingOptions);

dwTracker.track(
  'View Viewed',
  { page: 'Quote' },
  {
    integrations: {
      bigquery: false,
    },
  },
);

Preventing PII from being logged and shared

We should never log Personally Identifiable Information (PII) internally or share PII externally.

The tracker will console.warn if any keys in the object passed to the event properties are suspiciously named.

For example if an object with the key firstname is passed to a track event as its properties, there will be a warning.

Readme

Keywords

none

Package Sidebar

Install

npm i segment-wrapper

Weekly Downloads

4

Version

1.2.5-alpha.2

License

UNLICENSED

Unpacked Size

8.12 kB

Total Files

9

Last publish

Collaborators

  • bulb-bot