# Segment and keen.io

<https://app.segment.com/fu-good/overview>

設定專案

```javascript
const analytics = new Analytics(WRITE_KEY, { flushInterval: 1000 })

export const analyticsClient = bluebird.promisifyAll(analytics)
const properties = {}
await analyticsClient.trackAsync({
    userId: restaurantAlias,
    event: 'Stat Reservations',
    properties: {
       ...yourProperties
    },
})

//called flush finally
await analyticsClient.flushAsync()
```

Check Segmentation Debugger

<https://app.segment.com/fu-good/sources/restaurant_service/debugger>

![](https://1017997441-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-LfNCl-wVfadiT_RYx9b%2F-LfNCnod-7k9QKNb1EC-%2F-LfNCpGNKGYwZsVJn6RI%2F%E8%9E%A2%E5%B9%95%E5%BF%AB%E7%85%A7%202017-12-14%20%E4%B8%8B%E5%8D%883.54.45.png?generation=1558405666544150\&alt=media)
