From 2c0dbf706a9a07089962fbf352c96d010fe7f14f Mon Sep 17 00:00:00 2001 From: Scott Williams <5209283+scott-williams-az@users.noreply.github.com> Date: Thu, 1 May 2025 11:23:19 -0700 Subject: [PATCH 1/6] fix(static-site): add dataLayer tool, update documentation --- .../static-site/src/pages/DataLayerGuide.tsx | 99 ++++++++++++++----- packages/static-site/src/utils/baseUrl.ts | 11 ++- .../src/utils/watchDataLayerBookmarklet.js | 38 +++++++ 3 files changed, 125 insertions(+), 23 deletions(-) create mode 100644 packages/static-site/src/utils/watchDataLayerBookmarklet.js diff --git a/packages/static-site/src/pages/DataLayerGuide.tsx b/packages/static-site/src/pages/DataLayerGuide.tsx index 427d3cfae9..e52cbcd090 100644 --- a/packages/static-site/src/pages/DataLayerGuide.tsx +++ b/packages/static-site/src/pages/DataLayerGuide.tsx @@ -1,6 +1,15 @@ import { FC } from "react"; import { Link } from "react-router-dom"; import { PagePaths } from "~/routes/config"; +import { watchDataLayer } from "~/utils/watchDataLayerBookmarklet"; + +export const bookmarklet = `javascript:(${watchDataLayer.toString() + // remove line breaks + .replace(/\n/g,"") + // remove comments + .replace(/\/\*.*?\*\//g, "") + // replace multiple spaces with a single space + .replace(/\s+/g, " ")})();` const gtmCodes = { universal: "GTM-KDWN8Z", @@ -16,13 +25,13 @@ const GtmCodeExample: FC<{ gtmCode: string }> = ({ gtmCode }) => { */ const headScript = ` - - - `; + + + `; const bodyScript = `