Skip to content

Commit a9625ba

Browse files
committed
added new monetag
1 parent ca68b5e commit a9625ba

File tree

4 files changed

+20
-1
lines changed

4 files changed

+20
-1
lines changed

.env.example

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,9 @@ PUBLIC_GTM_ID=GTM-XXXXXXXXX
1515
# Google Analytics configuration
1616
PUBLIC_GA_MEASUREMENT_ID=G-XXXXXXXXXX
1717

18+
# Monetag configuration
19+
PUBLIC_MONETAG_KEY=XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
20+
1821
# Giscus configuration (public runtime)
1922
# Create these in GitHub Discussions settings for the repository
2023
PUBLIC_GISCUS_REPO=DailyNest/dailynest.github.io

.github/workflows/astro_deploy.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@ jobs:
4545
echo "PUBLIC_GOOGLE_SITE_VERIFICATION=${{ secrets.PUBLIC_GOOGLE_SITE_VERIFICATION }}" >> .env
4646
echo "PUBLIC_GTM_ID=${{ secrets.PUBLIC_GTM_ID }}" >> .env
4747
echo "PUBLIC_GA_MEASUREMENT_ID=${{ secrets.PUBLIC_GA_MEASUREMENT_ID }}" >> .env
48+
echo "PUBLIC_MONETAG_KEY=${{ secrets.PUBLIC_MONETAG_KEY }}" >> .env
4849
4950
# 4. Install dependencies and build site
5051
- name: Install dependencies and build site

src/components/bases/head.astro

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ import "@fontsource-variable/source-serif-4";
77
import { ClientRouter } from "astro:transitions";
88
import { SITE } from "@/lib/config";
99
import type { ArticleMeta, Meta } from "@/lib/types";
10-
import { GOOGLE_CONFIG, getGATagConfig, getGTMContainerId, hasGoogleAnalytics, hasGoogleTagManager, hasGoogleAdSense } from "@/utils/google-config";
10+
import { GOOGLE_CONFIG, getGATagConfig, getGTMContainerId, hasGoogleAnalytics, hasGoogleTagManager, hasGoogleAdSense, hasMonetag } from "@/utils/google-config";
1111
1212
type Props = {
1313
meta: Meta | ArticleMeta;
@@ -45,6 +45,11 @@ const OGImage = new URL(meta.ogImage, Astro.url).href;
4545
crossorigin="anonymous"></script>
4646
)}
4747

48+
<!-- Monetag -->
49+
{hasMonetag() && (
50+
<meta name="monetag" content={GOOGLE_CONFIG.MONETAG_KEY} />
51+
)}
52+
4853
<!-- Google Analytics and Consent Mode -->
4954
{hasGoogleAnalytics() && (
5055
<>

src/utils/google-config.ts

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,9 @@ export const GOOGLE_CONFIG = {
1515

1616
// Google Site Verification
1717
SITE_VERIFICATION: import.meta.env.PUBLIC_GOOGLE_SITE_VERIFICATION || "",
18+
19+
// Monetag Key
20+
MONETAG_KEY: import.meta.env.PUBLIC_MONETAG_KEY || "",
1821
} as const;
1922

2023
/**
@@ -53,3 +56,10 @@ export function hasGoogleTagManager(): boolean {
5356
export function hasGoogleAdSense(): boolean {
5457
return Boolean(GOOGLE_CONFIG.ADSENSE_CLIENT_ID);
5558
}
59+
60+
/**
61+
* Check if Monetag is configured
62+
*/
63+
export function hasMonetag(): boolean {
64+
return Boolean(GOOGLE_CONFIG.MONETAG_KEY);
65+
}

0 commit comments

Comments
 (0)