analytics
Segment plugin for 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.
const analytics = /* Track page views */analytics /* Track custom events */analytics /* Identify visitors */analytics
Plugin Options
Arguments
- pluginConfig
object
- Plugin settings - pluginConfig.writeKey
string
- Your segment writeKey - [pluginConfig.disableAnonymousTraffic] (optional)
boolean
- Disable loading segment for anonymous visitors
Example
See the full list of analytics provider plugins in the main repo.