Skip to content

Commit

Permalink
search parameter test (#2847)
Browse files Browse the repository at this point in the history
  • Loading branch information
lyleschemmerling authored Jan 24, 2024
1 parent 0901384 commit f1c335a
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -171,6 +171,16 @@ class Search {
paths = paths.slice(1, paths.length);
const environment = paths.shift();

try {
if (gtag) {
gtag('event', 'site_search', {
'search_parameter': this.#searchInput.value,
});
}
} catch (e) {
//ignore
}

if (!this.#pagefind) {
this.#pagefind = await import("/pagefind/pagefind.js");
// prime the filters
Expand Down
13 changes: 12 additions & 1 deletion astro/src/components/Head.astro
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ const isProd = import.meta.env.PROD as boolean;
<link rel="stylesheet" href="/css/sharp-thin.min.css"/>
<link rel="stylesheet" href="/css/solid.min.css"/>
<script src="/js/CopyToClipboard-0.2.2.js" type="text/javascript"></script>
<script src="/js/Search-0.2.0.js" type="text/javascript"></script>
<script src="/js/Search-0.2.1.js" type="text/javascript"></script>
<script src="/js/ScrollSpy-0.1.0.js" type="text/javascript"></script>
{ hasDark && <script src="/js/ThemeSelector-0.1.0.js" type="text/javascript"></script> }
<script src="/js/Visibility-0.1.1.js" type="text/javascript"></script>
Expand Down Expand Up @@ -64,6 +64,17 @@ const isProd = import.meta.env.PROD as boolean;
j=d.createElement(s),dl=l!='dataLayer'?'&l='+l:'';j.async=true;j.src=
'https://www.googletagmanager.com/gtm.js?id='+i+dl;f.parentNode.insertBefore(j,f);
})(window,document,'script','dataLayer','GTM-5P7VLHG');</script>

<!-- Google tag (gtag.js) -->
<script async src="https://www.googletagmanager.com/gtag/js?id=G-MZ9FDPFDF0"></script>
<script>
window.dataLayer = window.dataLayer || [];
function gtag(){dataLayer.push(arguments);}
gtag('js', new Date());

gtag('config', 'G-MZ9FDPFDF0');
</script>

<script>
var _paq = window._paq = window._paq || [];
/* tracker methods like "setCustomDimension" should be called before "trackPageView" */
Expand Down

0 comments on commit f1c335a

Please sign in to comment.