Skip to content
This repository has been archived by the owner on Oct 4, 2024. It is now read-only.

Commit

Permalink
Merge pull request #55 from axone-protocol/feat/matomo
Browse files Browse the repository at this point in the history
Add matomo analytics
  • Loading branch information
JulienMassonnat authored Jun 4, 2024
2 parents 33e39a7 + 74ea25e commit 5bdba4e
Show file tree
Hide file tree
Showing 4 changed files with 429 additions and 436 deletions.
13 changes: 4 additions & 9 deletions app/layout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import localFont from 'next/font/local';
import FaviconLinks from 'components/faviconLinks';
import Footer from 'components/footer';
import HeaderBar from 'components/headerBar';
import MatomoInitializer from 'components/MatomoInitializer';

const courrierPrime = Courier_Prime({
subsets: ['latin'],
Expand All @@ -22,19 +23,13 @@ export const metadata: Metadata = {
'Axone is the universal protocol to connect, share and monetize any resources in the AI stack',
};

export default function RootLayout ({
children,
}: Readonly<{
children: React.ReactNode;
}>) {
export default function RootLayout ({ children }: Readonly<{ children: React.ReactNode }>) {
return (
<html
lang='en'
className={`${courrierPrime.variable} ${SixtyFour.variable}`}
>
<html lang='en' className={`${courrierPrime.variable} ${SixtyFour.variable}`}>
<body className={`${courrierPrime.className}`}>
<FaviconLinks />
<HeaderBar />
<MatomoInitializer />
<div className='container mb-12 mt-24 space-y-20 md:mt-48'>
{children}
<Footer />
Expand Down
20 changes: 20 additions & 0 deletions components/MatomoInitializer.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
'use client';

import { init } from '@socialgouv/matomo-next';
import { useEffect } from 'react';

const MATOMO_URL = process.env.NEXT_PUBLIC_MATOMO_URL as string;
const MATOMO_SITE_ID = process.env.NEXT_PUBLIC_MATOMO_SITE_ID as string;

const MatomoInitializer = () => {
useEffect(() => {
if (!MATOMO_URL || !MATOMO_SITE_ID) {
return;
}
init({ url: MATOMO_URL, siteId: MATOMO_SITE_ID });
}, []);

return null;
};

export default MatomoInitializer;
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
"yarn": "~1.22.19"
},
"dependencies": {
"@socialgouv/matomo-next": "^1.9.0",
"bootstrap": "^5.3.3",
"next": "14.2.3",
"react": "^18",
Expand Down
Loading

0 comments on commit 5bdba4e

Please sign in to comment.