added gtm support

This commit is contained in:
Somrat
2025-04-28 10:20:07 +06:00
parent de5b943f38
commit 423ad81a1c
3 changed files with 24 additions and 1 deletions
+5
View File
@@ -33,6 +33,11 @@
"link": "https://github.com/zeon-studio/astroplate"
},
"google_tag_manager": {
"enable": false,
"gtm_id": "GTM-XXXXXX"
},
"disqus": {
"enable": true,
"shortname": "themefisher-template",
+17
View File
@@ -6,6 +6,10 @@ import { plainify } from "@/lib/utils/textConverter";
import Footer from "@/partials/Footer.astro";
import Header from "@/partials/Header.astro";
import "@/styles/main.css";
import {
GoogleTagmanager,
GoogleTagmanagerNoscript,
} from "@digi4care/astro-google-tagmanager";
import { AstroFont } from "astro-font";
import { ClientRouter } from "astro:transitions";
import SearchModal from "./helpers/SearchModal";
@@ -44,6 +48,12 @@ const { title, meta_title, description, image, noindex, canonical } =
<!doctype html>
<html lang="en">
<head>
<!-- google tag manager -->
{
config.google_tag_manager.enable && (
<GoogleTagmanager id={config.google_tag_manager.gtm_id} />
)
}
<!-- favicon -->
<link rel="shortcut icon" href={config.site.favicon} />
<!-- theme meta -->
@@ -171,6 +181,13 @@ const { title, meta_title, description, image, noindex, canonical } =
<meta name="twitter:card" content="summary_large_image" />
</head>
<body>
{/* google tag manager noscript */}
{
config.google_tag_manager.enable && (
<GoogleTagmanagerNoscript id={config.google_tag_manager.gtm_id} />
)
}
<TwSizeIndicator />
<Header />
<SearchModal client:load />