API

Events & Metrics

Use our count-events endpoints for analytics and metrics.

Count Events

Request

POST https://api.logspot.io/analytics/count-events

Params:

  • event_name - allows you to search for events with provided name
  • user_id - allows you to search for events from specific user
  • start_date - allows you to search for events with start time greater or equal start_date (inclusive - start of the day 00:00)
  • end_date - allows you to search for events with end time lower or equal end_date (inclusive - end of the day 23:59)
  • filter_groups - event filtering conditions

Request body:

{
    "event_name": "TicketPurchased",
    "user_id": "john@doe.com",
    "start_date": "2021-11-04",
    "end_date": "2021-11-10",
    "filter_groups": [
          {
              "filters": [
                  {
                      "field_name": "path",
                      "operator": "=",
                      "value": "/mobile-app"
                  }
              ]
          }
    ]
}

Response

{
    "status": "OK",
    "data": 81
}

Count Events Per Day

Request

POST https://api.logspot.io/analytics/count-events-per-day

Params:

  • event_name - allows you to search for events with provided name
  • user_id - allows you to search for events from specific user
  • start_date - allows you to search for events with start time greater or equal start_date (inclusive - start of the day 00:00)
  • end_date - allows you to search for events with end time lower or equal end_date (inclusive - end of the day 23:59)
  • filter_groups - event filtering conditions

Request body:

{
    "event_name": "TicketPurchased",
    "user_id": "john@doe.com",
    "start_date": "2021-11-04",
    "end_date": "2021-11-10",
    "filter_groups": [
          {
              "filters": [
                  {
                      "field_name": "path",
                      "operator": "=",
                      "value": "/mobile-app"
                  }
              ]
          }
    ]
}

Response

{
    "status": "OK",
    "data": [
        {
            "day": "2022-05-20T00:00:00.000Z",
            "count": 2
        },
        {
            "day": "2022-05-22T00:00:00.000Z",
            "count": 7
        },
        {
            "day": "2022-05-23T00:00:00.000Z",
            "count": 4
        }
    ]
}

Count Unique Users

Request

POST https://api.logspot.io/analytics/count-unique-users

Params:

  • event_name - allows you to search for events with provided name
  • start_date - allows you to search for events with start time greater or equal start_date (inclusive - start of the day 00:00)
  • end_date - allows you to search for events with end time lower or equal end_date (inclusive - end of the day 23:59)
  • filter_groups - event filtering conditions

Request body:

{
    "event_name": "TicketPurchased",
    "start_date": "2021-11-04",
    "end_date": "2021-11-10",
    "filter_groups": [
          {
              "filters": [
                  {
                      "field_name": "path",
                      "operator": "=",
                      "value": "/mobile-app"
                  }
              ]
          }
    ]
}

Response

{
    "status": "OK",
    "data": 81
}

Count Unique Users per Day

Request

POST https://api.logspot.io/analytics/count-unique-users-per-day

Params:

  • event_name - allows you to search for events with provided name
  • start_date - allows you to search for events with start time greater or equal start_date (inclusive - start of the day 00:00)
  • end_date - allows you to search for events with end time lower or equal end_date (inclusive - end of the day 23:59)
  • filter_groups - event filtering conditions

Request body:

{
    "event_name": "TicketPurchased",
    "start_date": "2021-11-04",
    "end_date": "2021-11-10",
    "filter_groups": [
          {
              "filters": [
                  {
                      "field_name": "path",
                      "operator": "=",
                      "value": "/mobile-app"
                  }
              ]
          }
    ]
}

Response

{
    "status": "OK",
    "data": [
        {
            "day": "2022-05-20T00:00:00.000Z",
            "count": 2
        },
        {
            "day": "2022-05-22T00:00:00.000Z",
            "count": 7
        },
        {
            "day": "2022-05-23T00:00:00.000Z",
            "count": 4
        }
    ]
}

Aggregate

Request

POST https://api.logspot.io/analytics/aggregate

Params:

  • event_name - allows you to search for events with provided name
  • metadata_field - aggregate and count events by metadata field
  • field - aggregate and count events by Logspot fields. List of available fields:
location_country, location_city, location_region, device, os, browser, screen, language, referrer, url, hostname, user_id
  • start_date - allows you to search for events with start time greater or equal start_date (inclusive - start of the day 00:00)
  • end_date - allows you to search for events with end time lower or equal end_date (inclusive - end of the day 23:59)
  • filter_groups - event filtering conditions

Request body:

{
    "event_name": "Pageview",
    "field": "browser",
    "start_date": "2020-08-16T22:00:00.000Z",
    "end_date": "2022-09-16T21:59:59.999Z",
    "filter_groups": [
        {
            "filters": [
                {
                    "field_name": "path",
                    "operator": "=",
                    "value": "/blog"
                }
            ]
        }
    ]
}

Response

{
    "status": "OK",
    "data": [
        {
            "property": "chrome",
            "count": 1638
        },
        {
            "property": "ios",
            "count": 445
        },
        {
            "property": "firefox",
            "count": 181
        },
        {
            "property": "safari",
            "count": 149
        },
        {
            "property": "crios",
            "count": 63
        },
        {
            "property": "edge-chromium",
            "count": 51
        },
        {
            "property": "chromium-webview",
            "count": 20
        },
        {
            "property": "opera",
            "count": 12
        },
        {
            "property": "samsung",
            "count": 8
        },
        {
            "property": "instagram",
            "count": 4
        },
        {
            "property": "facebook",
            "count": 2
        },
        {
            "property": "edge-ios",
            "count": 1
        },
        {
            "property": "yandexbrowser",
            "count": 1
        }
    ]
}