From 70def2783dd27aebd4b91e144e3941f15b049eb7 Mon Sep 17 00:00:00 2001 From: James Purser Date: Wed, 21 Jun 2023 20:33:23 +1000 Subject: [PATCH] Removed Google analytics from site --- components/audioplayer.js | 1 - lib/gtag.js | 21 --------------------- next.config.js | 4 +--- pages/_app.js | 9 +++------ pages/_document.js | 20 -------------------- pages/news/[slug].js | 1 - pages/podcasts/shows/[...episode].js | 1 - 7 files changed, 4 insertions(+), 53 deletions(-) delete mode 100755 lib/gtag.js diff --git a/components/audioplayer.js b/components/audioplayer.js index c7ebc78..27cad1c 100755 --- a/components/audioplayer.js +++ b/components/audioplayer.js @@ -7,7 +7,6 @@ const AbAudioPlayer = (audiodata) => {
gtag.event({action: "play", category:"audio", label: "audio started", value: audiodata.audio_mp3})} onPlay={_paq.push(['trackEvent', 'Podcasts', 'Play Podcast', audiodata.audio_mp3])} />
diff --git a/lib/gtag.js b/lib/gtag.js deleted file mode 100755 index 4086f00..0000000 --- a/lib/gtag.js +++ /dev/null @@ -1,21 +0,0 @@ -export const GA_TRACKING_ID = process.env.GTAG //'G-HDSXTW54QC' - -console.log(GA_TRACKING_ID) - -// https://developers.google.com/analytics/devguides/collection/gtagjs/pages -export const pageview = (url) => { - window.gtag('config', GA_TRACKING_ID, { - page_path: url, - }) - console.log("Page view action") -} - -// https://developers.google.com/analytics/devguides/collection/gtagjs/events -export const event = ({ action, category, label, value }) => { - window.gtag('event', action, { - event_category: category, - event_label: label, - value: value, - }) - console.log("event sent: " + action + ":" + category + ":" + label + ":" + value) -} diff --git a/next.config.js b/next.config.js index f6a0e48..0b96077 100755 --- a/next.config.js +++ b/next.config.js @@ -11,13 +11,11 @@ module.exports = { base_path: 'http://localhost:1337/api/', audio_path: 'https://audio.angrybeanie.com/', media_path: process.env.MEDIA_BASE, - strapi_token: process.env.STRAPI_TOKEN, - gtag: process.env.GTAG + strapi_token: process.env.STRAPI_TOKEN }, images: { domains: ['www.angrybeanie.com', 'localhost', 'cms.local.angrybeanie.com', '127.0.0.1'] }, publicRuntimeConfig: { - analytics_code: process.env.GTAG } } \ No newline at end of file diff --git a/pages/_app.js b/pages/_app.js index 97b9016..76ef4e1 100755 --- a/pages/_app.js +++ b/pages/_app.js @@ -6,12 +6,10 @@ import { Fragment, useEffect } from 'react'; import "../components/css/styles.css" import { Router, useRouter } from 'next/router' -//Router.events.on('routeChangeComplete', (url) => gtag.pageview(url)) - import { init } from "@socialgouv/matomo-next"; -const MATOMO_URL = "https://analytics.angrybeanie.com"; -const MATOMO_SITE_ID = 2; +const MATOMO_URL = process.env.NEXT_PUBLIC_MATOMO_URL; +const MATOMO_SITE_ID = process.env.NEXT_PUBLIC_MATOMO_SITE_ID; console.log(MATOMO_URL); @@ -19,8 +17,7 @@ function MyApp({ Component, pageProps }) { const router = useRouter() useEffect(() => { const handleRouteChange = (url) => { - // gtag.pageview(url); - // console.log("Pageview is happening") + }; init({ url: MATOMO_URL, siteId: MATOMO_SITE_ID }); router.events.on("routeChangeComplete", handleRouteChange); diff --git a/pages/_document.js b/pages/_document.js index 9dc3c71..b4df776 100755 --- a/pages/_document.js +++ b/pages/_document.js @@ -2,32 +2,12 @@ import Document, { Html, Head, Main, NextScript } from 'next/document'; import React from 'react'; import { Fragment } from 'react' -import { GA_TRACKING_ID } from '../lib/gtag' - class CustomDocument extends Document { render() { return ( - {/* Global Site Tag (gtag.js) - Google Analytics */} -