# Event Tracking Service API (1.1)

Tracking of events of any type for logging and future analysis purposes

## Tracking

Endpoints to capture events.

In each endpoint, the complete requested will be captured. Thus, additional query parameters and json properties in the request payload can be added on top of the ones described here.

## Capture event

All the contents of the HTTP request are logged and indexed for future analysis. That includes the full URL with query parameters and all request headers (including Audience-specific cookies).
This endpoint then returns the string "OK".

##### Query Parameters

| Parameter           | Description |
|---------------------|-------------|
| id_{idType}        | string<br>Overrides the request _UserId_ which is extracted by Cookie by default.<br>The `{idType}` should be replaced with the type of the _UserId_ while the parameter value will be _UserId_'s id itself. |
| user[type]         | string<br>Overrides the request _UserId_ which is extracted by Cookie by default.<br>It must be defined together with `user[id]`.<br>It has less precedence than the `id_{idType}` query param.<br>This query param must be sent url encoded (`user%5Btype%5D=`). |
| user[id]           | string<br>Overrides the request _UserId_ which is extracted by Cookie by default.<br>It must be defined together with `user[type]`.<br>It has less precedence than the `id_{idType}` query param.<br>This query param must be sent url encoded (`user%5Bid%5D=`). |
| cookieCheck         | string<br>If missing along with the **adstax_uid** Cookie, the request will be redirected to self to<br>test cookie stickiness. The redirect will have this query param set to true. |
| clientId            | string<br>The client identifier |
| siteId              | string<br>The site identifier |
| type                | string<br>The event type |
| cookies             | boolean<br>Default: true<br>If false, a new **adstax_uid** Cookie won't be generated if it is missing from the request. |

##### Header Parameters

| Parameter  | Description |
|------------|-------------|
| Cookie     | string<br>- **adstax_uid**: The default uid used to identify the user in Kevel Audience. If not present, a new one will be generated and set. |

### Responses

**200**

OK

**307**

Redirect to self to test cookie stickiness

### Post Capture Event

All the contents of the HTTP request are logged and indexed for future analysis. That includes the full URL with query parameters, the body payload and all request headers (including Audience-specific cookies).
This endpoint then returns the string "OK".

##### Request Body Schema: application/json

Event to capture. Fields declared here take precedence over query parameters.

| Parameter | Description |
|-----------|-------------|
| clientId  | string<br>The client identifier. |
| siteId    | string<br>The site identifier. |
| type      | string<br>The event type. |
| user      | object<br>Overrides the request _UserId_ which is extracted by Cookie by default.<br>It has less precedence than the `id_{idType}` query param. |

### Request Samples

- Payload

Content Type : application/json

`{"clientId": "string",  
"siteId": "string",  
"type": "string",  
"user": {"type": "string",  
"id": "string"}}`

### Capture Event and Redirect to URL

This endpoint then redirects to the given URL.

##### Query Parameters

| Parameter  | Description |
|------------|-------------|
| id_{idType}| string<br>Overrides the request _UserId_ which is extracted by Cookie by default.<br>The `{idType}` should be replaced with the type of the _UserId_ while the parameter value will be _UserId_'s id itself. |
| ourl      | string<br>The URL to which the browser will be redirected. This field must be URL-encoded. |
| cookieCheck| string<br>If missing along with the **adstax_uid** Cookie, the request will be redirected to self to<br>test cookie stickiness. The redirect will have this query param set to true. |
| clientId   | string<br>The client identifier |
| siteId     | string<br>The site identifier |
| type       | string<br>The event type |
| cookies    | boolean<br>Default: true<br>If false, a new **adstax_uid** Cookie won't be generated if it is missing from the request. |

### Privacy

Endpoints to manage user privacy preferences.

## Returns the Current Privacy Status

The privacy cookie is read if it exists and the current privacy status is returned.

### Responses

**200**

Successful request

### Opts Out of User Tracking

The privacy cookie is updated so that future match requests for that user are ignored.

##### Query Parameters

| Parameter | Description |
|-----------|-------------|
| token     | string<br>A token needed for alteration to the cookie privacy status.<br>It must match the token found inside the cookie `priv`. |

### Responses

**200**

Successful request

### Opts In to User Tracking

The privacy cookie is updated so that future match requests are considered normally.

##### Query Parameters

### Responses

**200**

Successful request
