Linking Matomo as a source

Let AI connect your sources for you

Skip the manual setup — run this in your project and the wizard auto-detects your databases and APIs and connects them to PostHog.

Learn more
PostHog Wizard hedgehog

Connect your Matomo instance to pull web analytics data into the PostHog data warehouse. Works with both Matomo Cloud and self-hosted instances.

Adding a data source

  1. Go to the sources tab of the data pipeline section in PostHog.
  2. Click + New source and then click Link next to Matomo.
  3. Enter your Instance URL – for example, https://myorg.matomo.cloud for Matomo Cloud or your self-hosted URL.
  4. Enter your Site ID – the numeric ID for the site you want to import. You can find this in your Matomo instance under Administration > Measurables/Websites > Manage.
  5. Create an API token in Matomo under Administration > Personal > Security > Auth tokens and paste it into the API token field.
  6. Select the tables you want to sync, set the sync method and frequency, then click Import.

Once the syncs are complete, you can query your Matomo data in PostHog.

Available tables

TableDescriptionSync method
visitsRaw visit log with visitor details, actions, and metadataIncremental
visits_summaryPer-day aggregate visit statisticsIncremental
actions_summaryPer-day aggregate action statisticsIncremental
referrersPer-day referrer breakdownIncremental
countriesPer-day visitor country breakdownIncremental
pagesPer-day page URL breakdownIncremental
goals_summaryPer-day aggregate goal conversion metricsIncremental
goalsGoal definitions lookup tableFull refresh
event_categoriesPer-day event breakdown by categoryIncremental
event_actionsPer-day event breakdown by actionIncremental
event_namesPer-day event breakdown by nameIncremental

Incremental tables sync only new or updated records on each run.

Full refresh tables are re-synced entirely on each run.

Sync details

  • The first sync backfills up to 365 days of history for all date-based tables.
  • The visits table uses serverTimestamp as its incremental cursor. Visits newer than one hour are deferred to the next sync to ensure their action lists are complete before storing.
  • Aggregate report tables (visits_summary, actions_summary, referrers, countries, pages, goals_summary, event_categories, event_actions, event_names) walk one day at a time and re-pull a 3-day trailing window on incremental runs to account for late archiving. Records are merged on _date (and label where applicable).
  • The goals table is a small lookup table containing goal definitions. It has no date dimension and is fully refreshed on each sync.

Configuration

OptionTypeRequired
Instance URLtextYes
Site IDtextYes
API tokenpasswordYes

Supported tables

TableDescriptionSync methodIncremental fieldPrimary key
visits

The raw visit log from Matomo's Live API — one row per visit with its actions and visitor details.

Incremental, Full refreshserverTimestamp—
visits_summary

Per-day aggregate visit metrics from Matomo's VisitsSummary API.

Incremental, Full refresh_date—
actions_summary

Per-day aggregate action metrics from Matomo's Actions API.

Incremental, Full refresh_date—
referrers

Per-day referrer breakdown from Matomo's Referrers API — one row per referrer.

Incremental, Full refresh_date—
countries

Per-day country breakdown from Matomo's UserCountry API — one row per country.

Incremental, Full refresh_date—
pages

Per-day page URL breakdown from Matomo's Actions API — one row per page URL.

Incremental, Full refresh_date—
goals_summary

Per-day aggregate goal conversion metrics across all goals from Matomo's Goals API.

Incremental, Full refresh_date—
event_categories

Per-day custom event breakdown by event category from Matomo's Events API — one row per event category.

Incremental, Full refresh_date—
event_actions

Per-day custom event breakdown by event action from Matomo's Events API — one row per event action.

Incremental, Full refresh_date—
event_names

Per-day custom event breakdown by event name from Matomo's Events API — one row per event name.

Incremental, Full refresh_date—
goals

The goals configured for the site in Matomo — one row per goal.

Full refresh——

Still have questions?

Was this page useful?