diff --git a/analytics.js b/analytics.js new file mode 100644 index 0000000..f602026 --- /dev/null +++ b/analytics.js @@ -0,0 +1,8 @@ +import MatomoTracker from '@datapunt/matomo-tracker-js'; + +const tracker = new MatomoTracker({ + urlBase: 'https://helplbrysavecrypto.com', + siteId: 12, +}); + +export const tracker; diff --git a/package.json b/package.json index baf9502..4a77ad3 100644 --- a/package.json +++ b/package.json @@ -8,6 +8,7 @@ "start": "next start" }, "dependencies": { + "@datapunt/matomo-tracker-js": "^0.4.0", "next": "10.0.9", "react": "17.0.2", "react-dom": "17.0.2", diff --git a/pages/index.js b/pages/index.js index ceb9cf7..1a61dcd 100644 --- a/pages/index.js +++ b/pages/index.js @@ -3,6 +3,7 @@ import Head from 'next/head'; import { Twitter } from '../component/twitter'; import { Stripe } from '../component/stripe'; import { t, m } from '../i18n'; +import { tracker } from '../analytics'; export default function Home() { const [email, setEmail] = React.useState(''); @@ -11,6 +12,10 @@ export default function Home() { const [emailSuccess, setEmailSuccess] = React.useState(); const lang = 'en'; // req.query.lang || 'en' + React.useEffect(() => { + tracker.trackPageView(); + }, []); + function __(message) { return t(message, lang); } @@ -46,6 +51,7 @@ export default function Home() { setEmailError(true); }); } + return (