Skip to main content

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

PropTypeDescription
configobjectRequired: your Matomo config
childrenReactNodeThe app children
debugbooleanEnable console logging
queueLimitnumberMax queue size (default: 50)

Example

<MatomoProvider config={matomoConfig} debug>
<MatomoAutoPageView />
<App />
</MatomoProvider>

That’s it — once wrapped, your app is ready to track events! 🚀