Skip to content
Permalink
 
 
Cannot retrieve contributors at this time
24 lines (21 sloc) 716 Bytes
import { Integration } from '../../src/integration';
import { Track, OrderCompleted } from '../../src/facade/events';
import { Success, ValidationError } from '../../src/responses'
interface Settings {}
export class BanjoAnalytics extends Integration {
constructor(public settings: Settings) {
super()
this.subscribe<OrderCompleted>('Order Completed', this.orderCompleted)
}
async track(event: Track) {
if (!event.userId) {
return new ValidationError('UserId is a required property of all track events')
}
console.log(event.event)
return new Success()
}
async orderCompleted(event: OrderCompleted) {
console.log(event.properties.revenue)
return new Success()
}
}
You can’t perform that action at this time.