Skip to content

Commit

Permalink
Merge pull request #14 from xNS5/development
Browse files Browse the repository at this point in the history
Removing google analytics
  • Loading branch information
xNS5 authored Dec 20, 2023
2 parents 54ec8b4 + 559fd5b commit d6e01b2
Show file tree
Hide file tree
Showing 3 changed files with 2 additions and 18 deletions.
3 changes: 0 additions & 3 deletions config.toml
Original file line number Diff line number Diff line change
Expand Up @@ -95,9 +95,6 @@ navbar_items = [
]},
]

[extra.analytics]
google="G-QK10RKYRF7"

[extra.author]
name = "Michael Kennedy"
avatar = "images/profile_picture.png"
Expand Down
2 changes: 1 addition & 1 deletion content/blog/work.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
+++
title = "Working for a living"
description = "Me talking about adulting stuff"
draft = false
draft = true
date = 2022-12-15
+++
---
Expand Down
15 changes: 1 addition & 14 deletions templates/base.html
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,7 @@
<script>
const lightSchemeIcon = document.getElementById('light-scheme-icon');
const darkSchemeIcon = document.getElementById('dark-scheme-icon');

if(window.matchMedia('(prefers-color-scheme: dark)').matches){
darkSchemeIcon.remove();
document.head.append(lightSchemeIcon);
Expand All @@ -112,20 +113,6 @@
document.head.append(darkSchemeIcon);
}

window.addEventListener("load", () => {
if (location.origin === 'https://www.michaelkennedy.dev') {
let head = document.getElementsByTagName("head")[0];
let outerScript = document.createElement('script');
let innerScript = document.createElement('script');
outerScript.setAttribute("async", "");
outerScript.setAttribute("src", "https://www.googletagmanager.com/gtag/js?id={{ config.extra.analytics.google }}");
innerScript.setAttribute("type", "text/javascript");
innerScript.innerHTML = 'window.dataLayer = window.dataLayer || []; function gtag() { dataLayer.push(arguments); } gtag("js", new Date()); gtag("config", "{{ config.extra.analytics.google }}");';
outerScript.appendChild(innerScript);
head.appendChild(outerScript);
}
});

function htmlDecode(input){
let doc = new DOMParser().parseFromString(input, 'text/html');
return doc.documentElement.textContent;
Expand Down

0 comments on commit d6e01b2

Please sign in to comment.