Skip to main content

Examples

Basic event tracking​

const { track } = useTrack();

track("cat.click", {
name: "Clicked Cat",
value: 1,
});

Page view tracking (auto)​

<MatomoAutoPageView />

Manual page view​

const { trackPageView } = useMatomo();

trackPageView("Manual Title", "/my-page");

Set user ID​

const { setUserId } = useMatomo();

setUserId("user-123");

Set user properties​

const { setUserProperties } = useMatomo();

setUserProperties({
1: "Premium",
2: "Mobile",
});