Skip to content

Commit

Permalink
docs: add google analytics for docs pages (zarf-dev#2530)
Browse files Browse the repository at this point in the history
## Description

Add Google Analytics for docs pages

## Related Issue

Fixes n/a

## Checklist before merging

- [X] Test, docs, adr added or updated as needed
- [X] [Contributor Guide
Steps](https://github.com/defenseunicorns/zarf/blob/main/.github/CONTRIBUTING.md#developer-workflow)
followed

---------

Signed-off-by: Xander Grzywinski <xandergrzyw@gmail.com>
  • Loading branch information
salaxander authored and schristoff committed May 22, 2024
1 parent fd43ac8 commit bdd0a2d
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 0 deletions.
13 changes: 13 additions & 0 deletions site/astro.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,19 @@ export default defineConfig({
integrations: [
starlight({
title: "Zarf",
head: [
{
tag: "script",
content: `(function(w,d,s,l,i){w[l]=w[l]||[];w[l].push({'gtm.start':
new Date().getTime(),event:'gtm.js'});var f=d.getElementsByTagName(s)[0],
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','G-N1XZ8ZXCWL');`,
},
],
components: {
SkipLink: "./src/components/SkipLink.astro",
},
social: {
github: "https://github.com/defenseunicorns/zarf",
slack: "https://kubernetes.slack.com/archives/C03B6BJAUJ3",
Expand Down
18 changes: 18 additions & 0 deletions site/src/components/SkipLink.astro
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
---
import type { Props } from '@astrojs/starlight/props'
import Default from '@astrojs/starlight/components/SkipLink.astro'
---

<!-- Add the noscript tag for Google Tag Manager. -->
<noscript>
<iframe
src="https://www.googletagmanager.com/gtag/js?id=G-N1XZ8ZXCWL"
height="0"
width="0"
style="display:none;visibility:hidden"
>
</iframe>
</noscript>

<!-- Render the default <SkipLink/> component. -->
<Default {...Astro.props}><slot /></Default>

0 comments on commit bdd0a2d

Please sign in to comment.