TrackEvents

POST/analytics/v1/events

Request Body

required
application/json
{
  "$ref": "#/components/schemas/analytics.v1.TrackEventsRequest",
  "$ref-value": {
    "type": "object",
    "properties": {
      "user_id": {
        "type": "string",
        "examples": [
          "QwErTy1234"
        ],
        "title": "user_id"
      },
      "country": {
        "type": "string",
        "examples": [
          "US"
        ],
        "title": "country"
      },
      "events": {
        "type": "array",
        "items": {
          "$ref": "#/components/schemas/analytics.v1.AnalyticsEvent",
          "$ref-value": {
            "type": "object",
            "anyOf": [
              {
                "type": "object",
                "properties": {
                  "content_view": {
                    "allOf": [
                      {
                        "$ref": "#/components/schemas/analytics.v1.ContentViewEvent",
                        "$ref-value": {
                          "type": "object",
                          "properties": {
                            "content_id": {
                              "type": "string",
                              "examples": [
                                "FpzVPNx1cG"
                              ],
                              "title": "content_id"
                            },
                            "content_type": {
                              "allOf": [
                                {
                                  "$ref": "#/components/schemas/analyticscommon.v1.MediaType",
                                  "$ref-value": {
                                    "type": "string",
                                    "title": "MediaType",
                                    "enum": [
                                      "MEDIA_TYPE_UNSPECIFIED",
                                      "MEDIA_TYPE_IMAGE",
                                      "MEDIA_TYPE_VIDEO"
                                    ]
                                  }
                                }
                              ],
                              "examples": [
                                "MEDIA_TYPE_VIDEO"
                              ],
                              "title": "content_type"
                            },
                            "feed_id": {
                              "type": "string",
                              "examples": [
                                "F4edRI23XL"
                              ],
                              "title": "feed_id"
                            },
                            "post_id": {
                              "type": "string",
                              "examples": [
                                "Mn0bVc9xZ8"
                              ],
                              "title": "post_id"
                            },
                            "view_type": {
                              "type": "string",
                              "examples": [
                                "post_view"
                              ],
                              "title": "view_type",
                              "enum": [
                                "start",
                                "watch",
                                "end"
                              ]
                            },
                            "watch_duration_ms": {
                              "allOf": [
                                {
                                  "$ref": "#/components/schemas/google.protobuf.Duration",
                                  "$ref-value": {
                                    "type": "string",
                                    "format": "duration",
                                    "description": "A signed duration in seconds, with up to nine fractional digits and an `s` suffix (for example, `3s` or `-0.001s`)."
                                  }
                                }
                              ],
                              "title": "watch_duration_ms"
                            },
                            "page": {
                              "type": "string",
                              "examples": [
                                "/feed"
                              ],
                              "title": "page",
                              "enum": [
                                "profile",
                                "feed",
                                "standalone"
                              ]
                            },
                            "video_position_ms": {
                              "allOf": [
                                {
                                  "$ref": "#/components/schemas/google.protobuf.Duration",
                                  "$ref-value": {
                                    "type": "string",
                                    "format": "duration",
                                    "description": "A signed duration in seconds, with up to nine fractional digits and an `s` suffix (for example, `3s` or `-0.001s`)."
                                  }
                                }
                              ],
                              "title": "video_position_ms"
                            },
                            "video_total_duration_ms": {
                              "allOf": [
                                {
                                  "$ref": "#/components/schemas/google.protobuf.Duration",
                                  "$ref-value": {
                                    "type": "string",
                                    "format": "duration",
                                    "description": "A signed duration in seconds, with up to nine fractional digits and an `s` suffix (for example, `3s` or `-0.001s`)."
                                  }
                                }
                              ],
                              "title": "video_total_duration_ms"
                            },
                            "segments": {
                              "type": "array",
                              "items": {
                                "$ref": "#/components/schemas/analytics.v1.Segment",
                                "$ref-value": {
                                  "type": "object",
                                  "properties": {
                                    "start_ms": {
                                      "allOf": [
                                        {
                                          "$ref": "#/components/schemas/google.protobuf.Duration",
                                          "$ref-value": {
                                            "type": "string",
                                            "format": "duration",
                                            "description": "A signed duration in seconds, with up to nine fractional digits and an `s` suffix (for example, `3s` or `-0.001s`)."
                                          }
                                        }
                                      ],
                                      "title": "start_ms"
                                    },
                                    "end_ms": {
                                      "allOf": [
                                        {
                                          "$ref": "#/components/schemas/google.protobuf.Duration",
                                          "$ref-value": {
                                            "type": "string",
                                            "format": "duration",
                                            "description": "A signed duration in seconds, with up to nine fractional digits and an `s` suffix (for example, `3s` or `-0.001s`)."
                                          }
                                        }
                                      ],
                                      "title": "end_ms"
                                    },
                                    "speed": {
                                      "type": "number",
                                      "examples": [
                                        "0.85"
                                      ],
                                      "title": "speed",
                                      "format": "double"
                                    },
                                    "subtitle_language": {
                                      "type": "string",
                                      "examples": [
                                        "en"
                                      ],
                                      "title": "subtitle_language",
                                      "description": "Unset fields inherit the value the view was opened with."
                                    },
                                    "audio_language": {
                                      "type": "string",
                                      "examples": [
                                        "fr"
                                      ],
                                      "title": "audio_language"
                                    },
                                    "quality": {
                                      "allOf": [
                                        {
                                          "$ref": "#/components/schemas/analyticscommon.v1.VideoQuality",
                                          "$ref-value": {
                                            "type": "string",
                                            "title": "VideoQuality",
                                            "enum": [
                                              "VIDEO_QUALITY_UNSPECIFIED",
                                              "VIDEO_QUALITY_BASIC",
                                              "VIDEO_QUALITY_SHORTS",
                                              "VIDEO_QUALITY_PRO"
                                            ]
                                          }
                                        }
                                      ],
                                      "title": "quality"
                                    },
                                    "chapter_title": {
                                      "type": "string",
                                      "examples": [
                                        "Introduction"
                                      ],
                                      "title": "chapter_title"
                                    }
                                  },
                                  "title": "Segment",
                                  "additionalProperties": false
                                }
                              },
                              "title": "segments"
                            },
                            "device_id": {
                              "type": "string",
                              "examples": [
                                "QwErTy1234"
                              ],
                              "title": "device_id"
                            },
                            "country": {
                              "type": "string",
                              "examples": [
                                "US"
                              ],
                              "title": "country"
                            },
                            "subtitle_language": {
                              "type": "string",
                              "examples": [
                                "en"
                              ],
                              "title": "subtitle_language"
                            },
                            "audio_language": {
                              "type": "string",
                              "examples": [
                                "en"
                              ],
                              "title": "audio_language"
                            },
                            "quality": {
                              "allOf": [
                                {
                                  "$ref": "#/components/schemas/analyticscommon.v1.VideoQuality",
                                  "$ref-value": {
                                    "type": "string",
                                    "title": "VideoQuality",
                                    "enum": [
                                      "VIDEO_QUALITY_UNSPECIFIED",
                                      "VIDEO_QUALITY_BASIC",
                                      "VIDEO_QUALITY_SHORTS",
                                      "VIDEO_QUALITY_PRO"
                                    ]
                                  }
                                }
                              ],
                              "title": "quality"
                            }
                          },
                          "title": "ContentViewEvent",
                          "additionalProperties": false
                        }
                      }
                    ],
                    "title": "content_view"
                  }
                },
                "title": "content_view"
              },
              {
                "type": "object",
                "properties": {
                  "engagement": {
                    "allOf": [
                      {
                        "$ref": "#/components/schemas/analytics.v1.EngagementEvent",
                        "$ref-value": {
                          "type": "object",
                          "properties": {
                            "engagement_type": {
                              "type": "string",
                              "examples": [
                                "like"
                              ],
                              "title": "engagement_type"
                            },
                            "resource_type": {
                              "type": "string",
                              "examples": [
                                "post"
                              ],
                              "title": "resource_type"
                            },
                            "resource_id": {
                              "type": "string",
                              "examples": [
                                "Mn0bVc9xZ8"
                              ],
                              "title": "resource_id"
                            },
                            "page": {
                              "type": "string",
                              "examples": [
                                "/feed"
                              ],
                              "title": "page"
                            },
                            "comment_text": {
                              "type": "string",
                              "examples": [
                                "Great post!"
                              ],
                              "title": "comment_text"
                            },
                            "share_platform": {
                              "type": "string",
                              "examples": [
                                "telegram"
                              ],
                              "title": "share_platform"
                            },
                            "country": {
                              "type": "string",
                              "examples": [
                                "US"
                              ],
                              "title": "country"
                            },
                            "device_type": {
                              "type": "string",
                              "examples": [
                                "mobile"
                              ],
                              "title": "device_type"
                            }
                          },
                          "title": "EngagementEvent",
                          "additionalProperties": false
                        }
                      }
                    ],
                    "title": "engagement"
                  }
                },
                "title": "engagement"
              },
              {
                "type": "object",
                "properties": {
                  "error": {
                    "allOf": [
                      {
                        "$ref": "#/components/schemas/analytics.v1.ErrorEvent",
                        "$ref-value": {
                          "type": "object",
                          "properties": {
                            "error_type": {
                              "type": "string",
                              "examples": [
                                "network_error"
                              ],
                              "title": "error_type"
                            },
                            "error_code": {
                              "type": "string",
                              "examples": [
                                "ERR_TIMEOUT"
                              ],
                              "title": "error_code"
                            },
                            "error_message": {
                              "type": "string",
                              "examples": [
                                "Request timed out"
                              ],
                              "title": "error_message"
                            },
                            "stack_trace": {
                              "type": "string",
                              "examples": [
                                "at fetchData (app.js:42)"
                              ],
                              "title": "stack_trace"
                            },
                            "resource_type": {
                              "type": "string",
                              "examples": [
                                "post"
                              ],
                              "title": "resource_type"
                            },
                            "resource_id": {
                              "type": "string",
                              "examples": [
                                "Mn0bVc9xZ8"
                              ],
                              "title": "resource_id"
                            },
                            "endpoint": {
                              "type": "string",
                              "examples": [
                                "/analytics/v1/events"
                              ],
                              "title": "endpoint"
                            },
                            "session_id": {
                              "type": "string",
                              "examples": [
                                "Bq4y3QB38S"
                              ],
                              "title": "session_id"
                            },
                            "device_type": {
                              "type": "string",
                              "examples": [
                                "mobile"
                              ],
                              "title": "device_type"
                            },
                            "browser": {
                              "type": "string",
                              "examples": [
                                "Chrome"
                              ],
                              "title": "browser"
                            },
                            "os": {
                              "type": "string",
                              "examples": [
                                "iOS"
                              ],
                              "title": "os"
                            }
                          },
                          "title": "ErrorEvent",
                          "additionalProperties": false
                        }
                      }
                    ],
                    "title": "error"
                  }
                },
                "title": "error"
              },
              {
                "type": "object",
                "properties": {
                  "interaction": {
                    "allOf": [
                      {
                        "$ref": "#/components/schemas/analytics.v1.InteractionEvent",
                        "$ref-value": {
                          "type": "object",
                          "properties": {
                            "interaction_type": {
                              "type": "string",
                              "examples": [
                                "click"
                              ],
                              "title": "interaction_type"
                            },
                            "element_type": {
                              "type": "string",
                              "examples": [
                                "button"
                              ],
                              "title": "element_type"
                            },
                            "element_id": {
                              "type": "string",
                              "examples": [
                                "play_button"
                              ],
                              "title": "element_id"
                            },
                            "session_id": {
                              "type": "string",
                              "examples": [
                                "Bq4y3QB38S"
                              ],
                              "title": "session_id"
                            },
                            "page": {
                              "type": "string",
                              "examples": [
                                "/feed"
                              ],
                              "title": "page"
                            },
                            "page_url": {
                              "type": "string",
                              "examples": [
                                "https://example.com"
                              ],
                              "title": "page_url"
                            },
                            "scroll_depth": {
                              "type": "number",
                              "examples": [
                                "0.85"
                              ],
                              "title": "scroll_depth",
                              "format": "double"
                            },
                            "search_query": {
                              "type": "string",
                              "examples": [
                                "funny videos"
                              ],
                              "title": "search_query"
                            },
                            "click_x": {
                              "type": "integer",
                              "examples": [
                                "1250"
                              ],
                              "title": "click_x",
                              "format": "int32"
                            },
                            "click_y": {
                              "type": "integer",
                              "examples": [
                                "1250"
                              ],
                              "title": "click_y",
                              "format": "int32"
                            },
                            "device_type": {
                              "type": "string",
                              "examples": [
                                "mobile"
                              ],
                              "title": "device_type"
                            },
                            "browser": {
                              "type": "string",
                              "examples": [
                                "Chrome"
                              ],
                              "title": "browser"
                            }
                          },
                          "title": "InteractionEvent",
                          "additionalProperties": false
                        }
                      }
                    ],
                    "title": "interaction"
                  }
                },
                "title": "interaction"
              },
              {
                "type": "object",
                "properties": {
                  "session_start": {
                    "allOf": [
                      {
                        "$ref": "#/components/schemas/analytics.v1.SessionStartEvent",
                        "$ref-value": {
                          "type": "object",
                          "properties": {
                            "utm_source": {
                              "type": "string",
                              "examples": [
                                "newsletter"
                              ],
                              "title": "utm_source"
                            },
                            "utm_campaign": {
                              "type": "string",
                              "examples": [
                                "summer_launch"
                              ],
                              "title": "utm_campaign"
                            },
                            "browser": {
                              "type": "string",
                              "examples": [
                                "Chrome"
                              ],
                              "title": "browser"
                            },
                            "language": {
                              "type": "string",
                              "examples": [
                                "en-US"
                              ],
                              "title": "language"
                            },
                            "screen_resolution": {
                              "type": "string",
                              "examples": [
                                "1920x1080"
                              ],
                              "title": "screen_resolution"
                            },
                            "platform": {
                              "type": "string",
                              "examples": [
                                "web"
                              ],
                              "title": "platform"
                            },
                            "tg_platform": {
                              "type": "string",
                              "examples": [
                                "tdesktop"
                              ],
                              "title": "tg_platform"
                            },
                            "tg_version": {
                              "type": "string",
                              "examples": [
                                "7.2.0"
                              ],
                              "title": "tg_version"
                            },
                            "timezone": {
                              "type": "string",
                              "examples": [
                                "America/New_York"
                              ],
                              "title": "timezone"
                            },
                            "timezone_offset": {
                              "type": "number",
                              "examples": [
                                "0.85"
                              ],
                              "title": "timezone_offset",
                              "format": "double"
                            },
                            "color_depth": {
                              "type": "number",
                              "examples": [
                                "0.85"
                              ],
                              "title": "color_depth",
                              "format": "double"
                            },
                            "touch_support": {
                              "type": "boolean",
                              "examples": [
                                "true"
                              ],
                              "title": "touch_support"
                            },
                            "country": {
                              "type": "string",
                              "examples": [
                                "US"
                              ],
                              "title": "country"
                            },
                            "user_id": {
                              "type": "string",
                              "examples": [
                                "QwErTy1234"
                              ],
                              "title": "user_id"
                            }
                          },
                          "title": "SessionStartEvent",
                          "additionalProperties": false
                        }
                      }
                    ],
                    "title": "session_start"
                  }
                },
                "title": "session_start"
              }
            ],
            "unevaluatedProperties": false,
            "not": {
              "allOf": [
                {
                  "anyOf": [
                    {
                      "required": [
                        "content_view"
                      ]
                    },
                    {
                      "required": [
                        "engagement"
                      ]
                    },
                    {
                      "required": [
                        "error"
                      ]
                    },
                    {
                      "required": [
                        "interaction"
                      ]
                    },
                    {
                      "required": [
                        "session_start"
                      ]
                    }
                  ]
                },
                {
                  "not": {
                    "oneOf": [
                      {
                        "required": [
                          "content_view"
                        ]
                      },
                      {
                        "required": [
                          "engagement"
                        ]
                      },
                      {
                        "required": [
                          "error"
                        ]
                      },
                      {
                        "required": [
                          "interaction"
                        ]
                      },
                      {
                        "required": [
                          "session_start"
                        ]
                      }
                    ]
                  }
                }
              ]
            },
            "properties": {
              "timestamp": {
                "allOf": [
                  {
                    "$ref": "#/components/schemas/google.protobuf.Timestamp",
                    "$ref-value": {
                      "type": "string",
                      "examples": [
                        "2023-01-15T01:30:15.01Z",
                        "2024-12-25T12:00:00Z"
                      ],
                      "format": "date-time",
                      "description": "A point in time in RFC 3339 format, with up to nanosecond precision. Output uses UTC (`Z`); input may use an offset from UTC."
                    }
                  }
                ],
                "examples": [
                  "2026-01-15T10:30:00Z"
                ],
                "title": "timestamp"
              }
            },
            "title": "AnalyticsEvent"
          }
        },
        "title": "events"
      },
      "city": {
        "type": "string",
        "examples": [
          "New York"
        ],
        "title": "city"
      },
      "region": {
        "type": "string",
        "examples": [
          "NY"
        ],
        "title": "region"
      },
      "device": {
        "type": "string",
        "examples": [
          "mobile"
        ],
        "title": "device"
      },
      "os": {
        "type": "string",
        "examples": [
          "iOS"
        ],
        "title": "os"
      },
      "os_version": {
        "type": "string",
        "examples": [
          "16.4.1"
        ],
        "title": "os_version"
      },
      "language": {
        "type": "string",
        "examples": [
          "en-US"
        ],
        "title": "language"
      },
      "browser": {
        "type": "string",
        "examples": [
          "Safari"
        ],
        "title": "browser"
      },
      "project_id": {
        "type": "string",
        "examples": [
          "Pr0j3ctId01"
        ],
        "title": "project_id",
        "description": "Project the events belong to (Organization > Project > Videos/Images/Posts/Feeds).\n Sent alongside the other envelope-level context because a client session is scoped\n to one project. org_id is still derived server-side from the credential and is\n never taken from the body, so a wrong project_id can only mis-attribute within the\n caller's own organization."
      }
    },
    "title": "TrackEventsRequest",
    "additionalProperties": false
  }
}

Response Body

200application/json

Success

type: unknown

{
  "$ref": "#/components/schemas/google.protobuf.Empty",
  "$ref-value": {
    "type": "object",
    "description": "An empty JSON object."
  }
}
curl -X POST "https://api.rixl.com/analytics/v1/events" \
  -H "Content-Type: application/json" \
  -d '{}'

Success

application/json

{
  "$ref": "#/components/schemas/google.protobuf.Empty",
  "$ref-value": {
    "type": "object",
    "description": "An empty JSON object."
  }
}