From 5695076373f81ccc835500a252d48e0db08d88b8 Mon Sep 17 00:00:00 2001 From: Koen Lagveen Date: Thu, 6 Jul 2023 20:04:38 +0200 Subject: [PATCH] track which font selected --- index.js | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/index.js b/index.js index f356e49..b31b6e1 100644 --- a/index.js +++ b/index.js @@ -44,7 +44,7 @@ function getFont () { } // ProgrammingFonts font selector -function selectFont () { +function selectFont (trigger) { const msg = document.querySelector('footer .subtitle') const codeMirror = document.querySelector('.CodeMirror') const font = getFont() @@ -91,6 +91,15 @@ function selectFont () { } } + if (trigger === 'hash') { + plausible(font) + plausible('Font Selected', { + props: { + font + } + }) + } + Cookies.set('font', font) } @@ -219,8 +228,7 @@ function walk (direction) { } window.onhashchange = () => { - plausible('Font Selected') - selectFont() + selectFont('hash') } window.addEventListener('DOMContentLoaded', () => {