MatomoProvider
MatomoProvider sets up the React Context and tracking engine.
You must wrap your app in this provider for tracking to work.
Basic usage
import { MatomoProvider } from "react-matomo-kit";
<MatomoProvider config={matomoConfig}>
<App />
</MatomoProvider>;
Configuration
const matomoConfig = {
siteId: "1",
trackerUrl: "https://your.matomo.server/",
srcUrl: "https://your.matomo.server/matomo.js",
};
Props
| Prop | Type | Description |
|---|---|---|
| config | object | Required: your Matomo config |
| children | ReactNode | The app children |
| debug | boolean | Enable console logging |
| queueLimit | number | Max queue size (default: 50) |
Example
<MatomoProvider config={matomoConfig} debug>
<MatomoAutoPageView />
<App />
</MatomoProvider>
That’s it — once wrapped, your app is ready to track events! 🚀