From 76a01a65d65483020bbdaed06bb0ff646cf58874 Mon Sep 17 00:00:00 2001 From: Sean Yesmunt Date: Sun, 28 Mar 2021 12:06:22 -0400 Subject: [PATCH] add matomo --- analytics.js | 8 ++++++++ package.json | 1 + pages/index.js | 6 ++++++ styles/globals.scss | 2 +- yarn.lock | 5 +++++ 5 files changed, 21 insertions(+), 1 deletion(-) create mode 100644 analytics.js 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 (
diff --git a/styles/globals.scss b/styles/globals.scss index 530e765..2371a55 100644 --- a/styles/globals.scss +++ b/styles/globals.scss @@ -118,7 +118,7 @@ main { } .landing__title { - font-size: 3rem; + font-size: 2.5rem; font-weight: 900; @media (min-width: $breakpoint-small) { diff --git a/yarn.lock b/yarn.lock index 823645e..82c3116 100644 --- a/yarn.lock +++ b/yarn.lock @@ -39,6 +39,11 @@ lodash "^4.17.13" to-fast-properties "^2.0.0" +"@datapunt/matomo-tracker-js@^0.4.0": + version "0.4.0" + resolved "https://registry.yarnpkg.com/@datapunt/matomo-tracker-js/-/matomo-tracker-js-0.4.0.tgz#0b5012e1de5d302f4ba169ae94904155e526266e" + integrity sha512-jOLKZCyPc1y8ZntTTW0vnHAbU1jQHA5Ibdyb7G9jt+KWvGDR2wotX4ki2/x7SMD+IfOrfKDJ9pXzVo29dPIjAg== + "@hapi/accept@5.0.1": version "5.0.1" resolved "https://registry.yarnpkg.com/@hapi/accept/-/accept-5.0.1.tgz#068553e867f0f63225a506ed74e899441af53e10"