Skip to content

feat(analytics): add video analytics pipeline with ingest server and event tracking#3

Merged
ahnv merged 29 commits into
mainfrom
video_analytics
Jul 1, 2026
Merged

feat(analytics): add video analytics pipeline with ingest server and event tracking#3
ahnv merged 29 commits into
mainfrom
video_analytics

Conversation

@aman051197

Copy link
Copy Markdown
Collaborator

No description provided.

… player adapter to prevent unintended pause events
aman-imagekit and others added 3 commits May 28, 2026 08:56
…n_fix

Enhance analytics tracking with custom dimensions and transport improvements
@aman051197 aman051197 changed the base branch from dev to main June 2, 2026 03:01
@aman051197 aman051197 requested a review from Copilot June 2, 2026 03:19

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR introduces a new client-side analytics pipeline for the ImageKit Video Player (event tracking → batching → wire-format encoding → ingest transport), wires it into the player plugin behind an analytics.enabled flag, and adjusts playlist thumbnail handling to avoid mutating shared source objects.

Changes:

  • Added an analytics subsystem (types, state machine, Video.js adapter, batching/transport, v1 wire format).
  • Integrated analytics initialization into the core player plugin + added analytics options to the public IKPlayerOptions.
  • Updated playlist thumbnail generation to avoid mutating the original playlist/source objects when applying default poster transformations.

Reviewed changes

Copilot reviewed 23 out of 23 changed files in this pull request and generated 7 comments.

Show a summary per file
File Description
packages/video-player/javascript/modules/playlist/thumbnail.ts Avoids mutating shared playlist item state when preparing poster thumbnails (but needs a prepared null-guard fix).
packages/video-player/javascript/modules/playlist/present-upcoming.ts Clones playlist items before applying default poster transformation for “Next up” UI.
packages/video-player/javascript/modules/playlist/playlist-menu-item.ts Clones playlist items before applying default poster transformation; caches prepared thumbnail.
packages/video-player/javascript/modules/analytics/wire-format-v1.ts Defines v1 positional wire schema + context key mapping + encoder/decoder utilities.
packages/video-player/javascript/modules/analytics/video-scale-percentage.ts Computes up/down-scale percentages from decoded vs displayed video size.
packages/video-player/javascript/modules/analytics/types.ts Adds analytics event/context types aligned with ingest schema expectations.
packages/video-player/javascript/modules/analytics/transport.ts Implements gzip→base64url GET transport with conditional keepalive.
packages/video-player/javascript/modules/analytics/player-adapter.ts Adapts Video.js runtime events into normalized analytics signals.
packages/video-player/javascript/modules/analytics/id-factory.ts Generates/persists session/player/playback/event identifiers.
packages/video-player/javascript/modules/analytics/event-row-encoder.ts Encodes internal events into canonical/slim shapes for wire encoding.
packages/video-player/javascript/modules/analytics/constants.ts Adds analytics defaults (ingest URL, batching knobs, thresholds).
packages/video-player/javascript/modules/analytics/batch-queue.ts Buffers events and flushes on interval/size/lifecycle triggers.
packages/video-player/javascript/modules/analytics/analytics-tracker.ts Orchestrates state machine + adapter + batching + context capture; hooks into plugin lifecycle.
packages/video-player/javascript/modules/analytics/analytics-state-machine.ts Enforces valid analytics event sequencing and computes timings.
packages/video-player/javascript/interfaces/Player.ts Extends public options with analytics config + error mapping types.
packages/video-player/javascript/index.ts Instantiates the analytics tracker when analytics.enabled is true.
packages/video-player/astro/IKVideoPlayer.astro Adds imperative mapError wiring support for Astro (functions not serializable).
examples/vue/src/App.vue Demonstrates enabling analytics in Vue example config.
examples/react/src/App.tsx Demonstrates enabling analytics in React example config.
examples/javascript/vite.config.ts Adds a second “try-it-yourself” page entry.
examples/javascript/src/try-it-yourself.ts Enables analytics via feature toggle in the JS example configurator.
examples/javascript/pages/try-it-yourself-2.html Adds an internal test page with analytics option in the UI.
examples/astro/src/pages/index.astro Adds an Astro example showing imperative mapError usage.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread packages/video-player/javascript/modules/analytics/analytics-tracker.ts Outdated
Comment thread packages/video-player/javascript/modules/analytics/batch-queue.ts
Comment thread packages/video-player/javascript/modules/analytics/batch-queue.ts
Comment thread packages/video-player/javascript/modules/analytics/constants.ts Outdated
Comment thread packages/video-player/javascript/modules/playlist/thumbnail.ts Outdated

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 23 out of 23 changed files in this pull request and generated 5 comments.

Comment thread packages/video-player/javascript/modules/analytics/analytics-tracker.ts Outdated
Comment thread packages/video-player/javascript/modules/analytics/analytics-tracker.ts Outdated
Comment thread packages/video-player/javascript/modules/analytics/constants.ts Outdated
Comment thread examples/astro/src/pages/index.astro
Comment thread packages/video-player/javascript/modules/analytics/batch-queue.ts
@aman051197 aman051197 requested a review from Copilot July 1, 2026 05:43
@aman051197 aman051197 changed the title feat(analytics): add video analytics pipeline with ingest server, event tracking, and ClickHouse schema feat(analytics): add video analytics pipeline with ingest server and event tracking Jul 1, 2026

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 26 out of 26 changed files in this pull request and generated 8 comments.

Comment thread packages/video-player/javascript/modules/analytics/constants.ts Outdated
Comment thread packages/video-player/javascript/modules/analytics/batch-queue.ts
Comment thread packages/video-player/javascript/modules/analytics/batch-queue.ts
Comment thread packages/video-player/javascript/modules/analytics/batch-queue.ts Outdated
Comment thread packages/video-player/javascript/modules/analytics/transport.ts Outdated
Comment thread packages/video-player/javascript/index.ts
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
@ahnv ahnv merged commit be0c360 into main Jul 1, 2026
1 check passed
@ahnv ahnv deleted the video_analytics branch July 1, 2026 15:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants