[examples/openspending][m]: implement analytics and update favicon (#896)

Co-authored-by: deme <joaommdemenech@gmail.com>
This commit is contained in:
Luccas Mateus 2023-05-19 15:13:38 -03:00 committed by GitHub
parent bedc9a8d33
commit 622428a015
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 3102 additions and 50 deletions

File diff suppressed because it is too large Load Diff

View File

@ -10,6 +10,7 @@
"test": "vitest"
},
"dependencies": {
"@flowershow/core": "^0.4.13",
"@githubocto/flat-ui": "^0.14.1",
"@heroicons/react": "^2.0.18",
"@octokit/plugin-throttling": "^5.2.2",
@ -22,7 +23,7 @@
"eslint": "8.39.0",
"eslint-config-next": "13.3.1",
"flexsearch": "0.7.21",
"next": "13.3.1",
"next": "13.3.0",
"next-seo": "^6.0.0",
"octokit": "^2.0.14",
"papaparse": "^5.4.1",

View File

@ -2,10 +2,52 @@ import { AppProps } from 'next/app';
import './styles.css';
import { NextSeo } from 'next-seo';
import { useEffect } from 'react';
import { pageview } from '@flowershow/core';
import Script from 'next/script';
import Head from 'next/head';
import { useRouter } from 'next/router';
function CustomApp({ Component, pageProps }: AppProps) {
const router = useRouter();
const GA_TOKEN = 'G-GXZF7NRXX6';
useEffect(() => {
const handleRouteChange = (url) => {
pageview(url);
};
router.events.on('routeChangeComplete', handleRouteChange);
return () => {
router.events.off('routeChangeComplete', handleRouteChange);
};
}, [router.events]);
return (
<>
<Head>
<link rel="shortcut icon" href="/squared_logo.png" />
</Head>
<NextSeo title="OpenSpending" />
<Script
strategy="afterInteractive"
src={`https://www.googletagmanager.com/gtag/js?id=${GA_TOKEN}`}
/>
<Script
id="gtag-init"
strategy="afterInteractive"
dangerouslySetInnerHTML={{
__html: `
window.dataLayer = window.dataLayer || [];
function gtag(){dataLayer.push(arguments);}
gtag('js', new Date());
gtag('config', ${GA_TOKEN}, {
page_path: window.location.pathname,
});
`,
}}
/>
<main className="app">
<Component {...pageProps} />
</main>

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.0 KiB