analytics-instrumentation
Skill by comet-ml
Adds product analytics events to Opik features on the frontend, Java backend, and Python SDK. It is for Opik contributors wiring events that report through Segment to PostHog.
Install analytics-instrumentation
Built from the published package, never by AI.
git clone --depth 1 https://github.com/comet-ml/opik /tmp/opik && mkdir -p ~/.claude/skills && cp -r /tmp/opik/.agents/skills/analytics-instrumentation ~/.claude/skills/analytics-instrumentationRun in your terminal. Claude Code loads skills from ~/.claude/skills automatically.
Step-by-step: install analytics-instrumentation in Claude Code
git clone --depth 1 https://github.com/comet-ml/opik /tmp/opik && mkdir -p ~/.gemini/antigravity-cli/skills && cp -r /tmp/opik/.agents/skills/analytics-instrumentation ~/.gemini/antigravity-cli/skills/analytics-instrumentationAntigravity CLI loads skills from ~/.gemini/antigravity-cli/skills, or .agents/skills for one project.
Step-by-step: install analytics-instrumentation in Antigravity CLI
Skills can run scripts on your machine. Some need an API key: check the README.
About
This skill is a set of conventions for adding product analytics (BI) events to Opik. Every event name must start with the opik_ prefix, and Segment routes those events to PostHog. The guide covers three places: a frontend tracking utility with a trackEvent call, a backend AnalyticsService with two trackEvent overloads, and a Python SDK analytics.track_event call that builds names from a path.
The skill explains how to pick event names, where the files live, and how identity is passed in reactive backend code. It also lists patterns to avoid, such as try/catch around trackEvent and unit tests that verify analytics calls. It includes a local verification method for Python events. The source is written for developers working inside the Opik repository.
Written from the project's SKILL.md and checked against it.
What it can do
- Frontend eventsAdd an OpikEvent constant and call trackEvent from a component or hook.
- Backend eventsCall AnalyticsService.trackEvent, passing explicit identity from background or reactive code.
- Python SDK eventsCall analytics.track_event with a path of component and method names.
- Local verificationIntercept the HTTP call to see the exact Python analytics payload without sending it.
What you need
- A checkout of the Opik repository
- Python with pytest for running the SDK analytics tests
- OPIK_ANALYTICS_ENABLED set to true to send backend events
Try asking
- Add a frontend analytics event for when a user submits an agent name
- Show me how to track a backend event from a reactive Mono chain
- Add a Python SDK analytics event for a new evaluation metric
Good to know
- Backend trackEvent does nothing unless OPIK_ANALYTICS_ENABLED is true, which is the default false.
- Python analytics reporting is off under pytest, so verification must run as a plain script.
- Backend trackEvent is not fully non-blocking because the identity fallback uses synchronous JDBC.
Security check
ANo download-and-run commands, hidden instructions or signs of sending keys out were found.
Checked automatically: .agents/skills/analytics-instrumentation/SKILL.md. This looks for known risky patterns and is not a full audit. How grades work
Inside the skill
-
SKILL.md17 KB
Alternatives to analytics-instrumentation
All alternatives →Guides an assistant through the Kaggle CLI, covering competitions, datasets, notebooks, models, benchmarks, authentication and quota. It is for people who use the kaggle command-line tool.
Generates Python code that uses BigQuery DataFrames (BigFrames) for data processing, analysis and machine learning on BigQuery. It is meant for Python data tasks, and the source says to use bigquery-basics for SQL-first workflows.
Discovers connected data sources and proposes loading options when a workspace lacks the data a question needs. Suited to users who want to connect database, warehouse or cloud sources from the chat.
Guides developers through enabling the Data Manager API, setting up Application Default Credentials, and installing its client libraries. Built for developers who are getting started with the API and need local environment and access setup.
Guides authoring and validating Apache Airflow DAGs for Managed Service for Apache Airflow (MSAA), formerly Cloud Composer. Built for developers who create or extend Airflow DAGs in these environments.
Extracts structured JSON data from over 40 websites, including Amazon, LinkedIn, Instagram, TikTok, Facebook and YouTube. Built on Bright Data's Web Data APIs, it returns product details, profiles, reviews, posts and comments from a URL.
Compare with kaggle-cli, bigquery-bigframes or data-loading
analytics-instrumentation: common questions
Where do Opik analytics events go?
The source says Segment routes opik_* events to PostHog. Backend events flow from comet-stats to Segment and then to PostHog.
Why must backend reactive events pass identity explicitly?
Inside a scheduler lambda RequestContext throws ProvisionException, so the event would fall back to an anonymous ID and lose user attribution.
Should I add tests for analytics events?
The source says not to add unit tests that verify analytics calls. Existing integration tests are expected to exercise these paths.
How do I install analytics-instrumentation?
Run the command above to copy the skill into ~/.claude/skills/. Claude Code picks it up automatically.
Is analytics-instrumentation free?
The code is published under the Apache-2.0 licence. The service it connects to may have its own pricing.
Is analytics-instrumentation safe to use?
It scores 89 of 100. Grades: maintenance A, licence A, quality A. Security check: grade A, no risky patterns found in the files checked. Review the code before you install. How grades work.
What are alternatives to analytics-instrumentation?
Similar skills: kaggle-cli, bigquery-bigframes, data-loading, data-manager-api-setup.
