# Segment

With Segment integration, you can send demo analytics as events to your Segment Account

### How to Integrate

* First, you will need to get your HTTP API write key from Segment by following the instructions [here](https://segment.com/docs/connections/find-writekey/).
* Share the write key to support team so it can be enabled for your account
* Once Segment is enabled, you will start receiving custom events when user engages with demo&#x20;

See demo on how to add source and get write key

{% @storylane/embed subdomain="app" linkValue="9t5ayndz3gbq" url="<https://app.storylane.io/share/9t5ayndz3gbq>" %}

### Custom Events

**Demo opened -** sent when demo is opened&#x20;

```json
{
  "anonymous_id": UUID,
  "event": 'sl_demo_open',
  "properties": {
    "demo_id": UUID,
    "demo_name": String,
    "demo_url": URL
  }
}
```

**Step viewed** - sent when flow step in guide is viewed

```json
{
  "anonymous_id": UUID,
  "event": 'sl_step_view',
  "properties": {
    "demo_id": UUID,
    "demo_name": String,
    "demo_url": URL,
    "flow_id": UUID,
    "flow_name": String,
    "step_id": UUID
  }
}
```

**Flow started** - sent when flow is started&#x20;

```json
{
  "anonymous_id": UUID,
  "event": 'sl_flow_start',
  "properties": {
    "demo_id": UUID,
    "demo_name": String,
    "demo_url": URL,
    "flow_id": UUID,
    "flow_name": String
  }
}
```

**Flow ended** - sent when flow ends&#x20;

```json
{
  "anonymous_id": UUID,
  "event": 'sl_flow_end',
  "properties": {
    "demo_id": UUID,
    "demo_name": String,
    "demo_url": URL,
    "flow_id": UUID,
    "flow_name": String
  }
}
```

**Lead Identify** - sent when lead is captured or identified

```json
{
  "anonymous_id": UUID,
  "user_id": UUID,
  "event": 'sl_lead_identify',
  "properties": {
    "demo_id": UUID,
    "demo_name": String,
    "demo_url": URL,
    "lead_id": UUID
  }
}
```

**CTA opened** - sent when CTA is clicked by user

```json
{
  "anonymous_id": UUID,
  "event": 'sl_cta_click',
  "properties": {
    "demo_id": UUID,
    "demo_name": String,
    "demo_url": URL,
    "cta_url": URL
  }
}
```

**Checklist completed** - sent when all flows are opened by the user

```json
{
  "anonymous_id": UUID,
  "event": 'sl_checklist_complete',
  "properties": {
    "demo_id": UUID,
    "demo_name": String,
    "demo_url": URL
  }
}
```
