google adsense

This commit is contained in:
Sammy Shear 2024-07-26 11:43:33 -04:00
parent a729386a92
commit 2b2745d669
Signed by: sammyshear
GPG Key ID: 69B1EDA35F4F4C09
4 changed files with 81 additions and 79 deletions

View File

@ -1,23 +1,25 @@
---
type Props = { measurementId: string }
const props = Astro.props as Props
const measurementId = props.measurementId
type Props = { measurementId: string };
const props = Astro.props as Props;
const measurementId = props.measurementId;
---
<script
type='text/partytown'
src={`https://www.googletagmanager.com/gtag/js?id=${measurementId}`}></script>
type="text/partytown"
src={`https://www.googletagmanager.com/gtag/js?id=${measurementId}`}
></script>
<script
type='text/partytown'
type="text/partytown"
data-ga-measurement-id={measurementId}
id='ga-init'
id="ga-init"
>
const measurementId = document
.getElementById('ga-init')
.getAttribute('data-ga-measurement-id')
window.dataLayer = window.dataLayer || []
.getElementById("ga-init")
.getAttribute("data-ga-measurement-id");
window.dataLayer = window.dataLayer || [];
function gtag() {
dataLayer.push(arguments) // eslint-disable-line
dataLayer.push(arguments); // eslint-disable-line
}
gtag('js', new Date())
gtag('config', measurementId)
gtag("js", new Date());
gtag("config", measurementId);
</script>

View File

@ -25,15 +25,13 @@ const {
<meta name="author" content={author} />
<meta name="description" content={description} />
<link rel="sitemap" href="/sitemap-index.xml" />
<meta name="google-adsense-account" content="ca-pub-2655673927481085" />
<title>{title}</title>
</head>
<body
class="flex flex-col place-items-center bg-ctp-base ctp-latte text-ctp-text dark:ctp-mocha"
>
<slot />
</body>
</html>
<style is:global>
html.dark .astro-code,
html.dark .astro-code span {
@ -67,3 +65,5 @@ const {
}
window.localStorage.setItem("theme", theme);
</script>
</body>
</html>