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
Architecture Overview
Prerequisites
- Completed the Getting Started tutorial
- Claude Code connected to OSC via MCP
- An OpenAI or Anthropic API key (for n8n AI agent)
Step-by-Step Guide
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 analyticsClaude 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.
Test with Analytics Demo
Verify your pipeline is working using the analytics demo site:
On the demo site:
- Paste your Eventsink URL in the configuration field
- Play the demo video
- 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.
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 automationClaude 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.
Create the AI Reporting Workflow
Open n8n and create a new workflow with an AI agent that generates daily reports. The workflow should:
- Schedule Trigger β Run daily at your preferred time
- ClickHouse Query β Fetch viewing statistics
- AI Agent β Analyze data and generate report
- 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.9This query calculates the watch progress (position / duration) and finds all sessions where users watched at least 90% of the video.
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 improvementConnect your preferred AI provider (OpenAI, Anthropic, etc.) in n8n credentials.
Schedule and Activate
Configure the Schedule Trigger to run daily:
- Set the trigger to "Cron" mode
- Configure for daily execution (e.g.,
0 9 * * *for 9am) - 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 ClickHouseExpand Reporting
Add more n8n workflows for weekly summaries or anomaly detection.
> Create weekly engagement summary workflowExplore More
Check out the Video Analytics use case for more ideas, or browse other tutorials.