From 46d8b712a88f7075e04db995efe8c9c00460ea06 Mon Sep 17 00:00:00 2001 From: Cotes Chung <11371340+cotes2020@users.noreply.github.com> Date: Sat, 18 May 2024 18:52:45 +0800 Subject: [PATCH] fix(analytics): goatcounter pv greater than 1K cannot be converted to numbers (#1762) The goatcounter PV report splits numbers with spaces, e.g. 1024 would be '1 024' --- _includes/pageviews/goatcounter.html | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/_includes/pageviews/goatcounter.html b/_includes/pageviews/goatcounter.html index af536dbd..e62fd698 100644 --- a/_includes/pageviews/goatcounter.html +++ b/_includes/pageviews/goatcounter.html @@ -9,7 +9,8 @@ fetch(url) .then((response) => response.json()) .then((data) => { - pv.innerText = new Intl.NumberFormat().format(data.count); + const count = data.count.replace(/\s/g, ''); + pv.innerText = new Intl.NumberFormat().format(count); }) .catch((error) => { pv.innerText = '1';