From d4ac27403bd30d398fb46748bdf8fa0d1d3fe0a0 Mon Sep 17 00:00:00 2001 From: Chuck Dries Date: Mon, 11 Jul 2022 09:49:56 -0700 Subject: [PATCH] skip fillter keyword resets for analytics --- src/pages/photogallery.js | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/src/pages/photogallery.js b/src/pages/photogallery.js index 7c9b268..7233719 100644 --- a/src/pages/photogallery.js +++ b/src/pages/photogallery.js @@ -30,12 +30,14 @@ const GalleryPage = ({ data }) => { const setKeyword = React.useCallback( (newKeyword) => { - try { - window.plausible("Filter Keyword", { - props: { keyword: newKeyword }, - }); - } catch (e) { - // do nothing + if (newKeyword) { + try { + window.plausible("Filter Keyword", { + props: { keyword: newKeyword }, + }); + } catch (e) { + // do nothing + } } _setKeyword(newKeyword); window.history.replaceState(