> For the complete documentation index, see [llms.txt](https://products.monterosa.co/mic/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://products.monterosa.co/mic/platform-extensions/analytics.md).

# Analytics

Allows to add a tab with Extension analytics data to the Event's analytics page. This feature is enabled by providing corresponding flag in instance handshake response.

## Analytics

<mark style="color:blue;">`GET`</mark> `https://example-extension.mic.io/lvis/:lvis_instance_id/projects/:project_id/events/:event_id/analytics_tab`

#### Path Parameters

| Name               | Type   | Description                                                  |
| ------------------ | ------ | ------------------------------------------------------------ |
| lvis\_instance\_id | string | Unique identifier across all M/IC instances, in UUID format. |
| project\_id        | string | Project UUID.                                                |
| event\_id          | string | Event UUID.                                                  |

{% tabs %}
{% tab title="200 " %}

```javascript
{
  "id": "demographics-audience",
  "name": "Audience",
  "final": false,
  "categories": [
    {
      "name": "Age breakdown",
      "items": [
        {
          "type": "string",
          "label": "Age < 18",
          "value": "30%"
        },
        {
          "type": "string",
          "label": "Age 19 - 55",
          "value": "50%"
        },
        {
          "type": "string",
          "label": "Age > 56",
          "value": "20%"
        }
      ]
    },
    {
      "name": "Gender breakdown",
      "items": [
        {
          "type": "string",
          "label": "Male",
          "value": "63%"
        },
        {
          "type": "string",
          "label": "Female",
          "value": "37%"
        }
      ]
    }
  ]
}
```

{% endtab %}
{% endtabs %}

## Example

{% tabs %}
{% tab title="cURL" %}

```bash
curl --request GET \
  --url https://example-extension.mic.io/lvis/c068dd33-46c3-4789-a619-b14e4bcbe990/projects/da34516f-00af-435e-bd03-ab1720755dda/events/a8552581-a10f-4fa7-85e9-7c9c82766be7/analytics_tab \
  --header 'Content-Type: application/vnd.api+json'
```

{% endtab %}

{% tab title="Response" %}

```javascript
{
  "id": "demographics-audience",
  "name": "Audience",
  "final": false,
  "categories": [
    {
      "name": "Age breakdown",
      "items": [
        {
          "type": "string",
          "label": "Age < 18",
          "value": "30%"
        },
        {
          "type": "string",
          "label": "Age 19 - 55",
          "value": "50%"
        },
        {
          "type": "string",
          "label": "Age > 56",
          "value": "20%"
        }
      ]
    },
    {
      "name": "Gender breakdown",
      "items": [
        {
          "type": "string",
          "label": "Male",
          "value": "63%"
        },
        {
          "type": "string",
          "label": "Female",
          "value": "37%"
        }
      ]
    }
  ]
}

```

{% endtab %}
{% endtabs %}

### Response parameters

`categories` define data sections and `items` define actual data. `type` defines how the data should be presented. Supported types are:

|            |                                                                                                                                                            |
| ---------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------- |
| categories | Data sections.                                                                                                                                             |
| items      | Actual analytics data. `type` defines how the data should be presented and the only `type` currently supported is `string`, which will display data as is. |
| final      | Informs that tab content will not change anymore and can be cached by the platform to be available anytime later without hitting the Extension.            |


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

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

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://products.monterosa.co/mic/platform-extensions/analytics.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

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.
