Removed Google analytics from site

This commit is contained in:
James Purser 2023-06-21 20:33:23 +10:00
parent ac64158f9a
commit 70def2783d
7 changed files with 4 additions and 53 deletions

View file

@ -7,7 +7,6 @@ const AbAudioPlayer = (audiodata) => {
<div className="audio"> <div className="audio">
<AudioPlayer <AudioPlayer
src={audiodata.audio_mp3.url} src={audiodata.audio_mp3.url}
//onPlay={e => gtag.event({action: "play", category:"audio", label: "audio started", value: audiodata.audio_mp3})}
onPlay={_paq.push(['trackEvent', 'Podcasts', 'Play Podcast', audiodata.audio_mp3])} onPlay={_paq.push(['trackEvent', 'Podcasts', 'Play Podcast', audiodata.audio_mp3])}
/> />
</div> </div>

View file

@ -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)
}

View file

@ -11,13 +11,11 @@ module.exports = {
base_path: 'http://localhost:1337/api/', base_path: 'http://localhost:1337/api/',
audio_path: 'https://audio.angrybeanie.com/', audio_path: 'https://audio.angrybeanie.com/',
media_path: process.env.MEDIA_BASE, media_path: process.env.MEDIA_BASE,
strapi_token: process.env.STRAPI_TOKEN, strapi_token: process.env.STRAPI_TOKEN
gtag: process.env.GTAG
}, },
images: { images: {
domains: ['www.angrybeanie.com', 'localhost', 'cms.local.angrybeanie.com', '127.0.0.1'] domains: ['www.angrybeanie.com', 'localhost', 'cms.local.angrybeanie.com', '127.0.0.1']
}, },
publicRuntimeConfig: { publicRuntimeConfig: {
analytics_code: process.env.GTAG
} }
} }

View file

@ -6,12 +6,10 @@ import { Fragment, useEffect } from 'react';
import "../components/css/styles.css" import "../components/css/styles.css"
import { Router, useRouter } from 'next/router' import { Router, useRouter } from 'next/router'
//Router.events.on('routeChangeComplete', (url) => gtag.pageview(url))
import { init } from "@socialgouv/matomo-next"; import { init } from "@socialgouv/matomo-next";
const MATOMO_URL = "https://analytics.angrybeanie.com"; const MATOMO_URL = process.env.NEXT_PUBLIC_MATOMO_URL;
const MATOMO_SITE_ID = 2; const MATOMO_SITE_ID = process.env.NEXT_PUBLIC_MATOMO_SITE_ID;
console.log(MATOMO_URL); console.log(MATOMO_URL);
@ -19,8 +17,7 @@ function MyApp({ Component, pageProps }) {
const router = useRouter() const router = useRouter()
useEffect(() => { useEffect(() => {
const handleRouteChange = (url) => { const handleRouteChange = (url) => {
// gtag.pageview(url);
// console.log("Pageview is happening")
}; };
init({ url: MATOMO_URL, siteId: MATOMO_SITE_ID }); init({ url: MATOMO_URL, siteId: MATOMO_SITE_ID });
router.events.on("routeChangeComplete", handleRouteChange); router.events.on("routeChangeComplete", handleRouteChange);

View file

@ -2,32 +2,12 @@ import Document, { Html, Head, Main, NextScript } from 'next/document';
import React from 'react'; import React from 'react';
import { Fragment } from 'react' import { Fragment } from 'react'
import { GA_TRACKING_ID } from '../lib/gtag'
class CustomDocument extends Document { class CustomDocument extends Document {
render() { render() {
return ( return (
<Html lang="en"> <Html lang="en">
<Head> <Head>
<Fragment> <Fragment>
{/* Global Site Tag (gtag.js) - Google Analytics */}
<script
async
src={`https://www.googletagmanager.com/gtag/js?id=${GA_TRACKING_ID}`}
/>
<script
dangerouslySetInnerHTML={{
__html: `
window.dataLayer = window.dataLayer || [];
function gtag(){dataLayer.push(arguments);}
gtag('js', new Date());
gtag('config', '${GA_TRACKING_ID}', {
page_path: window.location.pathname,
});
`,
}}
/>
<link rel="icon" href="/images/favicon-32.png" sizes="32x32" /> <link rel="icon" href="/images/favicon-32.png" sizes="32x32" />
<link rel="icon" href="/images/favicon-57.png" sizes="57x57" /> <link rel="icon" href="/images/favicon-57.png" sizes="57x57" />
<link rel="icon" href="/images/favicon-76.png" sizes="76x76" /> <link rel="icon" href="/images/favicon-76.png" sizes="76x76" />

View file

@ -5,7 +5,6 @@ import FeatureImage from "../../components/featureimage.js"
import StorySideBar from '../../components/storysidebar.js' import StorySideBar from '../../components/storysidebar.js'
import PublishedInfo from '../../components/publishedinfo.js' import PublishedInfo from '../../components/publishedinfo.js'
import { getAllPosts, getSinglePost } from '../../data/external/cms' import { getAllPosts, getSinglePost } from '../../data/external/cms'
import * as gtag from "../../lib/gtag"
import Image from "next/legacy/image"; import Image from "next/legacy/image";
import Head from 'next/head' import Head from 'next/head'
import config from "../../data/internal/config" import config from "../../data/internal/config"

View file

@ -1,7 +1,6 @@
import { useRouter } from 'next/router' import { useRouter } from 'next/router'
import getConfig from 'next/config' import getConfig from 'next/config'
import Layout from "../../../components/main.js" import Layout from "../../../components/main.js"
import * as gtag from "../../../lib/gtag"
import AudioPlayer from "react-h5-audio-player"; import AudioPlayer from "react-h5-audio-player";
import 'react-h5-audio-player/lib/styles.css'; import 'react-h5-audio-player/lib/styles.css';
import EpisodeSideBar from "../../../components/episodesidebar" import EpisodeSideBar from "../../../components/episodesidebar"