# E-ClickStream
### Write click stream event
- `Description:` This api will write the click stream event
- `Endpoint` : `/api/v1/public/click-stream/`
- `Method` : `POST`
- `Query Parameters` : n/a
- `Request Body` :
> Note: `clicked_at` value is unix timestamp in seconds.
> `event_type`, `clicked_at` and `session_id` is required field.
> The value of `item_type` will be `product`or `brand` or `shop`
```json
{
"event_type": "click",
"clicked_at": 1628424347,
"session_id": "lksdjf84lkdsjf984ujlkjd84",
"username": "nahid",
"current_url": "evaly.com.bd/products",
"prev_url": "evaly.com.bd/home",
"user_agent": "Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:15.0) Gecko/20100101 Firefox/15.0.1",
"client_ip": "172.0.0.1",
"platform": "evaly",
"item_id": "588",
"item_type": "product",
"page_number": 3,
"time_spent_seconds": 10
}
```
- `Response Body` :
```json
{
"message": "Event write is successfull",
"data": null
}
```
### Get click stream event list by date
- `Description:` This api will write the click stream event
- `Endpoint` : `/api/v1/public/click-stream/events`
- `Method` : `GET`
- `Headers`:
- `Application-Key`: The application secret key
- `Query Parameters` :
- `date`: The date for which we want to fetch the events. It is required and has to follow `yyyy-mm-dd` format.
- `limit`: Number of items per query
- `page-token`: The token to fetch next page of events.
- `Request Body` : n/a
- `Response Body` :
```json
{
"message": "Get events is successfull",
"data": {
"count": 2,
"next_page_token": "",
"items": [
{
"date": "2021-08-08",
"clicked_at": 1628424347,
"session_id": "lksdjf84lkdsjf984ujlkjd84",
"username": "nahid",
"event_type": "click",
"current_url": "evaly.com.bd/products",
"prev_url": "evaly.com.bd/home",
"user_agent": "Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:15.0) Gecko/20100101 Firefox/15.0.1",
"client_ip": "172.0.0.1",
"platform": "evaly",
"item_id": "588",
"item_type": "product",
"page_number": 3,
"time_spent_seconds": 10,
"device": "web"
},
{
"date": "2021-08-08",
"clicked_at": 1628424348,
"session_id": "lksdjf84lkdsuyr754dfujh948",
"username": "nahid-test",
"event_type": "click",
"current_url": "evaly.com.bd/products",
"prev_url": "evaly.com.bd/home",
"user_agent": "Mozilla/5.0 (Linux; Android 11) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/92.0.4515.159 Mobile Safari/537.36",
"client_ip": "172.0.0.1",
"platform": "evaly",
"item_id": "588",
"item_type": "product",
"page_number": 3,
"time_spent_seconds": 10,
"device": "mobile"
}
]
}
}
```
### Get total number of events per date
- `Description:` This api will give the number of event written on the specific date
- `Endpoint` : `/api/v1/public/click-stream/events/statistics/date`
- `Method` : `GET`
- `Headers`:
- `Application-Key`: The application secret key
- `Query Parameters` :
- `date`: The date for which we want to fetch the events. It is required and has to follow `yyyy-mm-dd` format.
- `Request Body` : n/a
- `Response Body` :
```json
{
"message": "Get nums of events by date is successfull",
"data": {
"count": 3
}
}
```
### Get number of events from web and mobile
- `Description:` This api will give the number of event written on the specific date from web and mobile
- `Endpoint` : `/api/v1/public/click-stream/events/statistics/device`
- `Method` : `GET`
- `Headers`:
- `Application-Key`: The application secret key
- `Query Parameters` :
- `date`: The date for which we want to fetch the events. It is required and has to follow `yyyy-mm-dd` format.
- `Request Body` : n/a
- `Response Body` :
```json
{
"message": "Get nums of events by device is successfull",
"data": {
"web": 2,
"mobile": 1
}
}
```