From 423ad81a1c4ee58f093f87f0d3dc00a4436172da Mon Sep 17 00:00:00 2001 From: Somrat <58769763+tfsomrat@users.noreply.github.com> Date: Mon, 28 Apr 2025 10:20:07 +0600 Subject: [PATCH] added gtm support --- package.json | 3 ++- src/config/config.json | 5 +++++ src/layouts/Base.astro | 17 +++++++++++++++++ 3 files changed, 24 insertions(+), 1 deletion(-) diff --git a/package.json b/package.json index 493c158..9d8ed04 100755 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "astroplate", - "version": "5.4.3", + "version": "5.5.0", "description": "Astro and Tailwindcss boilerplate", "author": "zeon.studio", "license": "MIT", @@ -21,6 +21,7 @@ "@astrojs/react": "4.2.4", "@astrojs/rss": "4.0.11", "@astrojs/sitemap": "3.3.0", + "@digi4care/astro-google-tagmanager": "^1.4.0", "@justinribeiro/lite-youtube": "^1.7.1", "astro": "5.7.4", "astro-auto-import": "^0.4.4", diff --git a/src/config/config.json b/src/config/config.json index 683fe50..d2250a6 100755 --- a/src/config/config.json +++ b/src/config/config.json @@ -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", diff --git a/src/layouts/Base.astro b/src/layouts/Base.astro index cc7ac47..efa4634 100755 --- a/src/layouts/Base.astro +++ b/src/layouts/Base.astro @@ -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 } =
+ + { + config.google_tag_manager.enable && ( +