0.2.3 • Published 5 years ago

analytics-plugin-segment v0.2.3

Weekly downloads
71
License
MIT
Repository
github
Last release
5 years ago

Segment plugin for analytics

Note: This package has moved to @analytics/segment

Integration with segment for analytics

For more information see the docs.

Usage

Install analytics and @analytics/segment packages

npm install analytics @analytics/segment

Initialize analytics with the segment plugin. After initialization the segment script will be automatically loaded into the page and send data to segment.

import Analytics from 'analytics'
import segmentPlugin from '@analytics/segment'

const analytics = Analytics({
  app: 'awesome-app',
  plugins: [
    segmentPlugin({
      writeKey: '123-xyz'
    })
    // ... other plugins
  ]
})

/* Track page views */
analytics.page()

/* Track custom events */
analytics.track('buttonClicked')

/* Identify visitors */
analytics.identify('user-xzy-123', {
  name: 'Bill Murray',
  cool: true
})

Plugin Options

Arguments

  • pluginConfig object - Plugin settings
  • pluginConfig.writeKey string - Your segment writeKey
  • pluginConfig.disableAnonymousTraffic (optional) boolean - Disable loading segment for anonymous visitors

Example

segmentPlugin({
  writeKey: '123-xyz'
})

See the full list of analytics provider plugins in the main repo.

0.2.3

5 years ago

0.2.2

5 years ago

0.2.1

5 years ago

0.2.0

5 years ago

0.1.7

5 years ago

0.1.6

5 years ago

0.1.5

5 years ago

0.1.4

5 years ago

0.1.3

5 years ago

0.1.2

5 years ago

0.1.1

5 years ago

0.1.0

5 years ago

0.0.5

5 years ago

0.0.4

5 years ago

0.0.3

5 years ago

0.0.2

5 years ago

0.0.1

5 years ago