# Context

As implied by its name the context is supposed to provide contextual information about an event. This will help to classify and interpret KPIs generated from the events. Put differently the context describes the user journey from the inside out. This can range from the specifics of single elements in a product set to global information such as the containing page or even enduser navigating the pages. Some of this contextual data will be attached at the API level. Other information has to be supplied from the client-side.

```javascript
{
  ...,
  "context": [
    {
      "content": {
        "customSet": {
          "id": "1b3de0bd-95c6-435a-8bb9-f4cae0160388",
        },
        "type": "customSet"
      },
      "type": "content",
    }
  ]
}
```

Similarly to the event structure itself, `context` elements will always have a `type` and optionally a type-specific payload named thereafter.&#x20;

{% hint style="info" %}
Currently, only two context types are supported: `content` and `user`.
{% endhint %}

## user

{% hint style="danger" %}
Currently **user-based metrics are required** for our current pricing mode&#x6C;**,** i.e. you have to provide a `user` context.
{% endhint %}

The `user` context is responsible for the event attribution:

```javascript
{ 
  "type": "user",
  "user": {
    "id": "<user-id>"
  }
}
```

Read the section about [user identification](/api-tracking/general/user-identification.md) for more information on user-based metrics and the requirements for the anonymized user ID.

## content

If the tracked interaction takes place within the context of some 8SELECT-provided content, e.g. a click on one of the products in an 8.SET-Custom product set, the following information must be included in the context of this event:

```javascript
{
  "content": {
    "customSet": {
      "id": "<set-id>",
    },
    "type": "customSet"
  },
  "type": "content",
}
```


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.8select.io/api-tracking/general/context.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
