You must register the provider in start/app.js
const providers = [
'adonis-segment/providers/Segment'
]
Add your SEGMENT_WRITEKEY
inside of your .env
file.
Once done you can access Segment
provider and fire off analytics events as follows.
const Segment = use('Avonian/Segment')
Segment.track({
userId: '019mr8mf4r',
event: 'Item Purchased',
properties: {
revenue: 39.95,
shippingMethod: '2-day'
}
});