add matomo

This commit is contained in:
Sean Yesmunt 2021-03-28 12:06:22 -04:00
parent 2c263ceda1
commit 76a01a65d6
5 changed files with 21 additions and 1 deletions

8
analytics.js Normal file
View file

@ -0,0 +1,8 @@
import MatomoTracker from '@datapunt/matomo-tracker-js';
const tracker = new MatomoTracker({
urlBase: 'https://helplbrysavecrypto.com',
siteId: 12,
});
export const tracker;

View file

@ -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",

View file

@ -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 (
<div>
<Head>

View file

@ -118,7 +118,7 @@ main {
}
.landing__title {
font-size: 3rem;
font-size: 2.5rem;
font-weight: 900;
@media (min-width: $breakpoint-small) {

View file

@ -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"