---
title: "Get Component Analytics"
method: POST
path: "/api/analytics/events/component"
tags: ["Analytics"]
---

# Get Component Analytics

`POST /api/analytics/events/component`

This route allows you to view the component analytics for a dataset.

## Headers

- `TR-Dataset` string, uuid, required

## Request body

- union
  - object
    - `filter` ComponentAnalyticsFilter
      - `component_name` string, nullable
      - `date_range` DateRange — DateRange is a JSON object which can be used to filter chunks by a range of dates. This leverages the time_stamp field on chunks in your dataset. You can specify this if you want values in a certain range. You must provide ISO 8601 combined date and time without timezone.
        - `gt` string, nullable
        - `gte` string, nullable
        - `lt` string, nullable
        - `lte` string, nullable
    - `granularity` 'minute' | 'second' | 'hour' | 'day' | 'month'
    - `type` 'total_unique_users', required
  - object
    - `filter` ComponentAnalyticsFilter
      - `component_name` string, nullable
      - `date_range` DateRange — DateRange is a JSON object which can be used to filter chunks by a range of dates. This leverages the time_stamp field on chunks in your dataset. You can specify this if you want values in a certain range. You must provide ISO 8601 combined date and time without timezone.
        - `gt` string, nullable
        - `gte` string, nullable
        - `lt` string, nullable
        - `lte` string, nullable
    - `page` integer, nullable
    - `type` 'top_pages', required
  - object
    - `filter` ComponentAnalyticsFilter
      - `component_name` string, nullable
      - `date_range` DateRange — DateRange is a JSON object which can be used to filter chunks by a range of dates. This leverages the time_stamp field on chunks in your dataset. You can specify this if you want values in a certain range. You must provide ISO 8601 combined date and time without timezone.
        - `gt` string, nullable
        - `gte` string, nullable
        - `lt` string, nullable
        - `lte` string, nullable
    - `page` integer, nullable
    - `type` 'top_components', required
  - object
    - `page` integer, nullable
    - `type` 'component_names', required
  - object
    - `filter` ComponentAnalyticsFilter
      - `component_name` string, nullable
      - `date_range` DateRange — DateRange is a JSON object which can be used to filter chunks by a range of dates. This leverages the time_stamp field on chunks in your dataset. You can specify this if you want values in a certain range. You must provide ISO 8601 combined date and time without timezone.
        - `gt` string, nullable
        - `gte` string, nullable
        - `lt` string, nullable
        - `lte` string, nullable
    - `granularity` 'minute' | 'second' | 'hour' | 'day' | 'month'
    - `type` 'component_interaction_time', required

## Response `200`

The component analytics for the dataset

- union
  - TotalUniqueUsersResponse
    - `points` IntegerTimePoint[], required
      - `point` integer, required
      - `time_stamp` string, required
    - `total_unique_users` integer, required
  - TopPagesResponse
    - `top_pages` TopPages[], required
      - `count` integer, required
      - `page` string, required
  - TopComponentsResponse
    - `top_components` TopComponents[], required
      - `cart_count` integer, required
      - `checkout_count` integer, required
      - `component_name` string, required
      - `count` integer, required
  - ComponentNamesResponse
    - `component_names` string[], required
  - ComponentInteractionTimeResponse
    - `avg_interaction_time` number, double, required
    - `points` FloatTimePoint[], required
      - `point` number, double, required
      - `time_stamp` string, required

## Other responses

- `400` — Service error relating to getting component analytics

---

[API](https://skmtc.net/devflowinc/apis/trieve-api.md) · [All operations](https://skmtc.net/devflowinc/apis/trieve-api/llms.txt) · [OpenAPI document](https://skmtc-service-staging.skmtc.workers.dev/v1/apis/devflowinc/trieve-api/revisions/84583e7c9fc1/schema)
