matomo-api

Matomo (Piwik) analytics platform API. Use for web analytics, tracking implementation, reporting API integration, plugin development, PHP/JavaScript tracking clients, and database schema understanding.

11 stars

Best use case

matomo-api is best used when you need a repeatable AI agent workflow instead of a one-off prompt.

Matomo (Piwik) analytics platform API. Use for web analytics, tracking implementation, reporting API integration, plugin development, PHP/JavaScript tracking clients, and database schema understanding.

Teams using matomo-api should expect a more consistent output, faster repeated execution, less prompt rewriting.

When to use this skill

  • You want a reusable workflow that can be run more than once with consistent structure.

When not to use this skill

  • You only need a quick one-off answer and do not need a reusable workflow.
  • You cannot install or maintain the underlying files, dependencies, or repository context.

Installation

Claude Code / Cursor / Codex

$curl -o ~/.claude/skills/matomo-api/SKILL.md --create-dirs "https://raw.githubusercontent.com/enuno/claude-command-and-control/main/skills-templates/matomo-api/SKILL.md"

Manual Installation

  1. Download SKILL.md from GitHub
  2. Place it in .claude/skills/matomo-api/SKILL.md inside your project
  3. Restart your AI agent — it will auto-discover the skill

How matomo-api Compares

Feature / Agentmatomo-apiStandard Approach
Platform SupportNot specifiedLimited / Varies
Context Awareness High Baseline
Installation ComplexityUnknownN/A

Frequently Asked Questions

What does this skill do?

Matomo (Piwik) analytics platform API. Use for web analytics, tracking implementation, reporting API integration, plugin development, PHP/JavaScript tracking clients, and database schema understanding.

Where can I find the source code?

You can find the source code on GitHub using the link provided at the top of the page.

SKILL.md Source

# Matomo API Skill

Comprehensive API reference for Matomo (formerly Piwik), the open-source web analytics platform. Covers tracking APIs, reporting APIs, JavaScript/PHP clients, and database schema.

## When to Use This Skill

This skill should be triggered when:
- Implementing Matomo tracking on websites or applications
- Building integrations with Matomo's Reporting API
- Querying analytics data programmatically
- Setting up event tracking, goal conversions, or ecommerce tracking
- Working with Matomo's JavaScript or PHP tracking clients
- Understanding Matomo's database structure for custom queries
- Implementing consent management and privacy controls
- Debugging Matomo tracking issues

## Quick Reference

### Tracking HTTP API Endpoint

```
https://your-matomo-domain.example/matomo.php
```

**Required Parameters:**
- `idsite` - Website ID being tracked
- `rec=1` - Required to enable tracking

**Common Parameters:**
- `action_name` - Page title for pageviews
- `url` - Full URL of the current action
- `_id` - 16-character hexadecimal visitor ID
- `rand` - Random value to prevent caching
- `apiv=1` - API version

### Event Tracking Parameters
- `e_c` - Event category
- `e_a` - Event action
- `e_n` - Event name
- `e_v` - Event value (numeric)

### Goal Conversion
- `idgoal` - Goal ID to trigger conversion
- `revenue` - Monetary value for conversion

### Ecommerce Parameters
- `ec_id` - Order ID
- `ec_items` - JSON array of items
- `revenue` - Total order value
- `ec_st` - Subtotal
- `ec_tx` - Tax
- `ec_sh` - Shipping
- `ec_dt` - Discount

### Reporting API Endpoint

```
https://your-matomo-domain.example/index.php?module=API&method=MODULE.METHOD&format=FORMAT
```

**Standard Parameters:**
| Parameter | Values | Purpose |
|-----------|--------|---------|
| `idSite` | Integer or comma-separated | Website ID(s) |
| `period` | day, week, month, year, range | Time period |
| `date` | YYYY-MM-DD or magic keywords | Specific date |
| `format` | xml, json, csv, tsv, html, rss | Output format |
| `token_auth` | Your API token | Authentication |

**Date Magic Keywords:**
- `today`, `yesterday`
- `lastWeek`, `lastMonth`, `lastYear`
- `lastX` (e.g., `last7`)
- `previousX` (e.g., `previous30`)

### JavaScript Tracking

```javascript
// Page view
_paq.push(['trackPageView', 'Custom Page Title']);

// Event
_paq.push(['trackEvent', 'Category', 'Action', 'Name', Value]);

// Goal conversion
_paq.push(['trackGoal', goalId, customRevenue]);

// Site search
_paq.push(['trackSiteSearch', 'keyword', 'category', resultsCount]);

// Ecommerce order
_paq.push(['trackEcommerceOrder', orderId, grandTotal, subTotal, tax, shipping, discount]);
```

### PHP Tracking

```php
use MatomoTracker;

$tracker = new MatomoTracker($idSite, 'https://matomo.example.com/');
$tracker->setTokenAuth($token);
$tracker->setUserId($userId);
$tracker->doTrackPageView('Page Title');
$tracker->doTrackEvent('Category', 'Action', 'Name', $value);
$tracker->doTrackGoal($idGoal, $revenue);
```

### Consent Management (JavaScript)

```javascript
// Require consent before tracking
_paq.push(['requireConsent']);

// When user gives consent
_paq.push(['setConsentGiven']);

// Cookie-specific consent
_paq.push(['requireCookieConsent']);
_paq.push(['rememberCookieConsentGiven', hoursToExpire]);

// Opt-out
_paq.push(['optUserOut']);
```

## Reference Files

This skill includes comprehensive documentation in `references/`:

- **tracking-http-api.md** - HTTP Tracking API specification
- **reporting-api.md** - Reporting API methods and parameters
- **javascript-client.md** - JavaScript Tracking Client reference
- **php-client.md** - PHP Tracking Client reference
- **database-schema.md** - Database tables and relationships

## Common Patterns

### Bulk Tracking (HTTP)

```json
POST https://matomo.example.com/matomo.php
{
  "requests": [
    "?idsite=1&rec=1&url=https://example.org/page1",
    "?idsite=1&rec=1&url=https://example.org/page2"
  ],
  "token_auth": "your_token_here"
}
```

### Bulk API Requests (Reporting)

```
?module=API&method=API.getBulkRequest
&urls[0]=method%3DVisitsSummary.get%26idSite%3D1%26period%3Dday%26date%3Dtoday
&urls[1]=method%3DActions.getPageUrls%26idSite%3D1%26period%3Dday%26date%3Dtoday
```

### Segmentation

```
# Visits from mobile devices in United States
&segment=deviceType==smartphone;countryCode==us

# Visits with specific event
&segment=eventCategory==Video;eventAction==Play
```

### PHP Bulk Tracking

```php
$tracker->enableBulkTracking();
$tracker->doTrackPageView('Page 1');
$tracker->doTrackPageView('Page 2');
$tracker->doTrackEvent('Category', 'Action');
$tracker->doBulkTrack(); // Send all at once
```

## Key API Modules

### Visitor Analytics
- `VisitsSummary` - Overall visit metrics
- `UserCountry` - Geographic data
- `DevicesDetection` - Device and browser info
- `UserLanguage` - Language preferences

### Actions & Content
- `Actions` - Pages, downloads, outlinks
- `Events` - Custom event tracking
- `Contents` - Content impression tracking

### Conversions
- `Goals` - Goal conversions and revenue
- `Ecommerce` - Ecommerce transactions

### Traffic Sources
- `Referrers` - Traffic source analysis
- `MarketingCampaignsReporting` - Campaign tracking

### Real-time
- `Live` - Real-time visitor data
- `Live.getLastVisitsDetails` - Recent visitor details

## Core Metrics

| Metric | Description |
|--------|-------------|
| `nb_uniq_visitors` | Unique visitors |
| `nb_visits` | Total visits (30-min session) |
| `nb_actions` | Page views, downloads, outlinks |
| `bounce_rate` | Single-page visit percentage |
| `avg_time_on_page` | Average page duration |
| `revenue` | Goal/ecommerce revenue |
| `conversion_rate` | Goal achievement ratio |

## Database Tables

### Log Data (Raw)
- `log_visit` - Individual visits
- `log_link_visit_action` - Actions within visits
- `log_action` - Action definitions (URLs, titles)
- `log_conversion` - Goal conversions
- `log_conversion_item` - Ecommerce items

### Archive Data (Aggregated)
- `archive_numeric_YYYY_MM` - Numeric metrics
- `archive_blob_YYYY_MM` - Report data (compressed)

### Configuration
- `site` - Website configuration
- `goal` - Goal definitions
- `segment` - Saved segments
- `user` - User accounts
- `access` - User permissions

## Authentication

### Token Authentication
```
&token_auth=YOUR_TOKEN_HERE
```

- Create tokens in: Administration > Personal > Security > Auth tokens
- Never share URLs containing tokens publicly
- Use POST requests with token in body for enhanced security

### Features Requiring Auth
- IP address override (`cip`)
- Custom timestamp (`cdt`)
- Geolocation override (`country`, `region`, `city`, `lat`, `long`)

## Performance Tips

1. **Use Bulk Tracking** - Batch multiple tracking calls
2. **Cache API Responses** - Set appropriate cache headers
3. **Use Segments Sparingly** - Complex segments impact performance
4. **Archive Data** - Query archive tables for historical reports
5. **Limit Results** - Use `filter_limit` to restrict row counts

## Resources

- [Official API Documentation](https://developer.matomo.org/api-reference)
- [Tracking HTTP API](https://developer.matomo.org/api-reference/tracking-api)
- [Reporting API](https://developer.matomo.org/api-reference/reporting-api)
- [JavaScript Client](https://developer.matomo.org/api-reference/tracking-javascript)
- [PHP Client](https://developer.matomo.org/api-reference/PHP-Piwik-Tracker)
- [Database Schema](https://developer.matomo.org/guides/database-schema)

## Notes

- Matomo was formerly known as Piwik
- API supports both Matomo 4.x and 5.x versions
- Session timeout default is 30 minutes
- Visitor ID is 16-character hexadecimal
- All tracking requests should include `rec=1` parameter

Related Skills

web-artifacts-builder

11
from enuno/claude-command-and-control

Suite of tools for creating elaborate, multi-component claude.ai HTML artifacts using modern frontend web technologies (React, Tailwind CSS, shadcn/ui). Use for complex artifacts requiring state management, routing, or shadcn/ui components - not for simple single-file HTML/JSX artifacts.

ui-ux-pro-max

11
from enuno/claude-command-and-control

UI/UX design intelligence. 50 styles, 21 palettes, 50 font pairings, 20 charts, 8 stacks (React, Next.js, Vue, Svelte, SwiftUI, React Native, Flutter, Tailwind). Actions: plan, build, create, design, implement, review, fix, improve, optimize, enhance, refactor, check UI/UX code. Projects: website, landing page, dashboard, admin panel, e-commerce, SaaS, portfolio, blog, mobile app, .html, .tsx, .vue, .svelte. Elements: button, modal, navbar, sidebar, card, table, form, chart. Styles: glassmorphism, claymorphism, minimalism, brutalism, neumorphism, bento grid, dark mode, responsive, skeuomorphism, flat design. Topics: color palette, accessibility, animation, layout, typography, font pairing, spacing, hover, shadow, gradient.

turbo-sdk

11
from enuno/claude-command-and-control

Complete Arweave Turbo ecosystem including client SDKs, core upload infrastructure, payment service backend, and CLI tools for permanent decentralized storage

terraform-best-practices

11
from enuno/claude-command-and-control

Comprehensive best practices for Terraform infrastructure as code from Anton Babenko's community guide

sveltekit-svelte5-tailwind-skill

11
from enuno/claude-command-and-control

Comprehensive integration skill for building sites with SvelteKit 2, Svelte 5, and Tailwind CSS v4

workflow-ship-faster

11
from enuno/claude-command-and-control

Ship Faster end-to-end workflow for small web apps (default: Next.js 16.1.1): idea/prototype → foundation gate → design-system.md → lightweight guardrails + docs → feature iteration → optional Supabase + Stripe → optional GitHub + Vercel deploy → optional AI-era SEO (sitemap/robots/llms.txt). Resumable, artifact-first under runs/ship-faster/ (or OpenSpec changes/). Trigger: ship/launch/deploy/production-ready MVP.

workflow-project-intake

11
from enuno/claude-command-and-control

Use when you need to clarify requirements and route to the right workflow (idea → executable input). Project intake + routing: help the user brainstorm and clarify intent, persist goal/context artifacts, then dispatch to the right workflow or step skill. Default route is workflow-ship-faster (Next.js 16.1.1) for idea/prototype→launch. Triggers: project kickoff, requirements clarification, brainstorm, ideas, discovery, intake.

workflow-feature-shipper

11
from enuno/claude-command-and-control

Use when you need to ship a single PR-sized feature end-to-end (plan -> implement -> verify) with artifacts. Ship core product features quickly in a Next.js codebase: turn a feature idea into an executable plan, implement in PR-sized slices, and keep artifacts under runs/ (or OpenSpec changes/ when available). Supports plan-only mode for early scoping. For prototype UI work, include a demo-ready wow moment (animation/micro-interaction) by default unless user opts out.

workflow-creator

11
from enuno/claude-command-and-control

Create workflow-* skills by composing existing skills into end-to-end chains. Turns a user idea into a workflow_spec.md SSOT (via workflow-brainstorm), discovers available skills locally + from skills.sh, and generates a new workflow-<slug>/ skill package. Use when you want to design a new workflow, chain multiple skills into a flow, or turn scattered atomic skills into a resumable plan-then-confirm workflow.

workflow-brainstorm

11
from enuno/claude-command-and-control

Use when you need to turn a vague idea into a confirmed design spec before implementation (new feature/component/behavior change). First check project context, then ask one question at a time, provide 2-3 options with trade-offs, finally output design in segments (~200-300 words each) with confirmation after each. Triggers: brainstorm, clarify idea, design spec, refine concept, requirement clarification.

tool-x-article-publisher

11
from enuno/claude-command-and-control

Publish Markdown to X (Twitter) Articles as a draft (never auto-publish). Use when the user asks to publish/post an article to X Articles, convert Markdown to X Articles rich text, or mentions "X article", "publish to X", "post to Twitter articles". Converts Markdown → HTML, pastes rich text, and inserts images deterministically.

tool-ui-ux-pro-max

11
from enuno/claude-command-and-control

Use when you need concrete UI/UX inputs (palette, typography, landing patterns, UX/a11y constraints) to drive design or review. Searchable UI/UX design intelligence (styles, palettes, typography, landing patterns, charts, UX/a11y guidelines + stack best practices) backed by CSV + a Python search script. Triggers: UIUX/uiux, UI/UX, UX design, UI design, design system, design spec, color palette, typography, layout, animation, accessibility/a11y, component styling. Actions: search, recommend, review, improve UI.