Automate Product Analyticsreports with your agent and the CX CLI
Every page view, click, and session your RUM SDK captures lands in Coralogix as a log event under the cx_rum subsystem — the raw data behind how people actually use your product. You can turn it into a shareable report without writing a single query. Just ask your coding agent.
Your agent queries that data through the CX CLI and writes the report for you: describe what you want in plain English, get a formatted report back — without leaving the terminal.
Works with any coding agent. Claude Code, Cursor, GitHub Copilot, Codex — any tool that can run a shell command works with this workflow.
cx initinstalls the CX agent skills, and from there your agent has direct access to all your Coralogix data.
Set up
Install the CX CLI and run:
cx init
This configures your profile OAuth login through the browser) and installs the CX agent skills into your coding agent. Once done, your agent knows how to run cx commands and has access to the full DataPrime query interface.
Turn one prompt into a complete visual report
Ask your agent for the report you want as an HTML file, and it comes back ready to share: headline KPIs with week-over-week deltas, a bar chart of top pages, the checkout funnel, an errors table, and a short “what changed this week” summary.
No dashboards to build, no UI, no design work — just one prompt.
Take the RUM data for the ‘shop’ app from the last 7 days and render it as a single self-contained HTML report — no external dependencies. Include headline KPIs with week-over-week deltas, a bar chart of top pages, the checkout funnel with per-step conversion, an errors table, and a one-paragraph “what changed this week” summary. Make it work in light and dark mode.
That’s a stakeholder-ready report in the time it takes to describe it — and because it’s one self-contained file, it opens anywhere: screenshot it, drop it in a doc or Slack, commit it, or wire it into a weekly cron job.
Keep in mind it’s a point-in-time snapshot. For an always-live view, build it as a Coralogix dashboard with cx dashboards instead.
Get the same insights directly in your terminal
Want the numbers without the chrome — for a quick glance, a commit-friendly diff, or piping into another tool? Ask for the same report as plain markdown and it lands right in your terminal:
Query RUM data for the ‘shop’ app over the last 7 days. Show: (1) top 10 pages by session count, (2) top clicked elements on /checkout, (3) user counts at each step of /cart → /checkout → /payment → /confirm, (4) pages with the most errors. Format the output as a report with a summary line and a table for each section.
Behind that one sentence, the agent runs four DataPrime queries through the CX CLI, gets compact results back, and synthesizes this — without leaving the terminal or touching the UI:
# Weekly Product Analytics Report — shop app
*Period: last 7 days*
## Top pages by session count
| Page | Sessions |
|------|----------|
| /home | 5,204 |
| /catalog | 3,411 |
| /cart | 2,908 |
| /checkout | 2,153 |
| /payment | 1,486 |
| /confirm | 1,032 |
## Most clicked elements on /checkout
| Element | Clicks | Unique sessions |
|---------|--------|-----------------|
| Place Order | 1,342 | 891 |
| Apply Coupon | 743 | 612 |
| Continue Shopping | 401 | 398 |
| Edit Cart | 289 | 271 |
## Funnel: /cart → /checkout → /payment → /confirm
| Step | Users | Conversion |
|------|-------|------------|
| /cart | 2,341 | — |
| /checkout | 1,847 | 79% |
| /payment | 1,203 | 65% |
| /confirm | 987 | 82% |
## Pages with the most errors
| Page | Errors | Affected users |
|------|--------|----------------|
| /payment | 312 | 187 |
| /checkout | 89 | 76 |
| /catalog | 41 | 38 |
**Summary:** The biggest drop is /checkout → /payment (35%), and /payment carries the most errors (187 users affected). Investigating /payment errors is the highest-priority action this week.
That’s the whole loop — one prompt in, a shareable report out, no query language required. If you want to see or tweak the exact commands, they’re in “The commands your agent runs” at the end.
Go further: interpretation with Olly
Counting tells you what happened; for why, have your agent send the question to Olly, Coralogix’s built-in AI analyst. Just describe what you want to understand:
Ask Olly why checkout → payment conversion dropped this week — have it dig into the /payment errors and the most-clicked elements over the last 14 days, wait for the investigation to finish, and include any charts it generates.
Follow-ups work the same way — keep pulling on the thread in plain English:
Ask Olly which single error is affecting the most users on /payment, and what it would fix first.
When the investigation finishes, ask your agent to pull in what Olly produced — it retrieves the generated charts and tables and folds them into your report.
The commands your agent runs
Most people will just ask their agent, like above. But the CX CLI is a first-class tool you can run yourself — handy for scripting a report, wiring it into CI, or a quick one-off in the terminal. These are the exact commands the agent runs under the hood; the DataPrime query is the string in quotes. Swap the app, paths, or time window to fit your flow; the RUM field reference covers the other fields you can group or filter on.
1. Top pages by traffic
cx logs "filter \$l.subsystemname == 'cx_rum' && \$d.cx_rum.version_metadata.app_name == 'my-app' && \$d.cx_rum.event_context.type == 'life-cycle' | groupby \$d.cx_rum.page_context.page_fragments aggregate distinct_count(\$d.cx_rum.session_context.session_id) as sessions | orderby sessions desc" --start now-7d -o toon
2. What users click on a given page (swap /checkout for any path)
cx logs "filter \$l.subsystemname == 'cx_rum' && \$d.cx_rum.version_metadata.app_name == 'my-app' && \$d.cx_rum.event_context.type == 'user-interaction' && \$d.cx_rum.page_context.page_fragments ~ '/checkout' && \$d.cx_rum.interaction_context.target_element_inner_text != null && \$d.cx_rum.interaction_context.target_element_inner_text != '' | groupby \$d.cx_rum.interaction_context.target_element_inner_text aggregate count() as clicks, distinct_count(\$d.cx_rum.session_context.session_id) as unique_sessions | orderby clicks desc" --start now-7d -o toon
3. Funnel step counts
cx logs "filter \$l.subsystemname == 'cx_rum' && \$d.cx_rum.version_metadata.app_name == 'my-app' && ['/cart', '/checkout', '/payment', '/confirm'].arrayContains(\$d.cx_rum.page_context.page_fragments) | groupby \$d.cx_rum.page_context.page_fragments aggregate distinct_count(\$d.cx_rum.session_context.user_id) as users | orderby users desc" --start now-14d -o toon
This gives per-page user counts, not a strict ordered funnel (a user who skipped /cart and landed on /checkout still counts at /checkout). For a strict sequential funnel, use the Funnels view in the Product Analytics UI.
4. Pages with the most errors
cx logs "filter \$l.subsystemname == 'cx_rum' && \$d.cx_rum.version_metadata.app_name == 'my-app' && \$d.cx_rum.event_context.severity:num == 5 | groupby \$d.cx_rum.page_context.page_fragments aggregate count() as errors, distinct_count(\$d.cx_rum.session_context.user_id) as affected_users | orderby affected_users desc" --start now-7d -o toon
Interpretation with Olly
Run Olly directly from the terminal:
cx olly ask "Why did checkout → payment conversion drop this week? Look at the /payment errors and the most-clicked elements on /checkout over the last 14 days." --agent-to-agent-mode
Re-pass
--agent-to-agent-modeon every call. Olly doesn’t remember it between turns. For follow-ups, save thechat_idfrom the first response and pass--chat-id <id>. Olly runs on a GPT model by default — pass--modelto pick another (e.g. an Anthropic model when you’re in Claude). Investigations can take minutes, so run the call as a background process or pass--timeoutfor a longer window.
Then pull whatever it generated:
cx olly artifacts list -o json
cx olly artifacts get <artifact-id>