All Tutorials
AI Agents
Advanced
30 min

Video Analytics with AI Reporting

Deploy a complete video analytics pipeline and automate daily AI-powered reports that tell you how many users watched your content to completion.

What You'll Learn

Deploy a multi-service analytics pipeline
Connect eventsink, queue, worker, and ClickHouse
Set up n8n workflow automation
Create AI-powered automated reports

Architecture Overview

Video Player
↓
Eventsink
↓
ClickHouse
↓
n8n + AI

Prerequisites

Step-by-Step Guide

1

Deploy the Analytics Pipeline

Ask Claude to deploy a complete Open Analytics solution. This will create and connect multiple services:

> Deploy an Open Analytics solution for video analytics

Claude will provision the following interconnected services:

  • Eventsink β€” HTTP endpoint to receive analytics events
  • Queue β€” Message queue to buffer incoming events
  • Worker β€” Processes events and writes to database
  • ClickHouse β€” Column-oriented database for analytics

Note: The deployment can take a few minutes to complete while all services are provisioned and connected.

Once the deployment is complete, ask Claude for the Eventsink URL:

> What is the Eventsink URL for my analytics pipeline?

Tip: Save this URL β€” you'll need it in the next step to test your pipeline.

2

Test with Analytics Demo

Verify your pipeline is working using the analytics demo site:

On the demo site:

  1. Paste your Eventsink URL in the configuration field
  2. Play the demo video
  3. Watch as analytics events are submitted to your pipeline

Success! If events are being received, your analytics pipeline is working. You can verify by asking Claude to query the ClickHouse database.

3

Deploy n8n Workflow Automation

Now set up n8n for workflow automation. Ask Claude to create both n8n and its task runner:

> Create an n8n instance with task runner for workflow automation

Claude will deploy n8n (a powerful workflow automation tool) and configure the task runner for executing workflows.

Note: Save the n8n URL and credentials. You'll use these to access the n8n workflow editor.

4

Create the AI Reporting Workflow

Open n8n and create a new workflow with an AI agent that generates daily reports. The workflow should:

  1. Schedule Trigger β€” Run daily at your preferred time
  2. ClickHouse Query β€” Fetch viewing statistics
  3. AI Agent β€” Analyze data and generate report
  4. Output β€” Send report via email, Slack, or webhook

For the ClickHouse query, use something like:

SELECT
  session_id,
  MAX(position / duration) as max_progress
FROM epas_epasdemo
WHERE timestamp >= today() - 1
  AND duration > 0
GROUP BY session_id
HAVING max_progress >= 0.9

This query calculates the watch progress (position / duration) and finds all sessions where users watched at least 90% of the video.

5

Configure the AI Agent Node

In the n8n workflow, add an AI Agent node and configure it to analyze the viewing data. Use a prompt like:

Analyze this video viewing data and create a daily report.
Include:
- Total number of viewers who watched 90%+ of the video
- Comparison to previous day if available
- Any notable trends or insights
- Recommendations for content improvement

Connect your preferred AI provider (OpenAI, Anthropic, etc.) in n8n credentials.

6

Schedule and Activate

Configure the Schedule Trigger to run daily:

  1. Set the trigger to "Cron" mode
  2. Configure for daily execution (e.g., 0 9 * * * for 9am)
  3. Save and activate the workflow

Done! Your AI-powered analytics reporting is now automated. Every day, you'll receive insights about your video engagement.

Analytics Pipeline Complete!

You now have a production-ready video analytics pipeline with automated AI reporting. Every day, you'll receive insights about viewer engagement and content performance.

What's Next?

Add Grafana Dashboards

Create real-time visualizations of your analytics data with Grafana.

> Add Grafana connected to my ClickHouse

Expand Reporting

Add more n8n workflows for weekly summaries or anomaly detection.

> Create weekly engagement summary workflow

Explore More

Check out the Video Analytics use case for more ideas, or browse other tutorials.