From 7b77e7e8a2aac53c5fa6f161830efc72d2aa82c5 Mon Sep 17 00:00:00 2001 From: "Jason R. Stevens, CFA" Date: Thu, 11 Apr 2024 10:04:13 -0600 Subject: [PATCH 1/3] :label: add url type to GTMParams --- packages/third-parties/src/types/google.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/packages/third-parties/src/types/google.ts b/packages/third-parties/src/types/google.ts index 30a4e9f28a464..8216ef3c664e0 100644 --- a/packages/third-parties/src/types/google.ts +++ b/packages/third-parties/src/types/google.ts @@ -11,6 +11,7 @@ export type GTMParams = { dataLayerName?: string auth?: string preview?: string + url?: string } export type GAParams = { From bbf69eb3b9efd6d69b978cb7cba54fb7c82376a2 Mon Sep 17 00:00:00 2001 From: "Jason R. Stevens, CFA" Date: Thu, 11 Apr 2024 10:08:02 -0600 Subject: [PATCH 2/3] :sparkles: add url parameter to GTMParams to enable server-side GTM --- packages/third-parties/src/google/gtm.tsx | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/packages/third-parties/src/google/gtm.tsx b/packages/third-parties/src/google/gtm.tsx index 1203525cc1e34..6296a7356a489 100644 --- a/packages/third-parties/src/google/gtm.tsx +++ b/packages/third-parties/src/google/gtm.tsx @@ -8,7 +8,7 @@ import type { GTMParams } from '../types/google' let currDataLayerName: string | undefined = undefined export function GoogleTagManager(props: GTMParams) { - const { gtmId, dataLayerName = 'dataLayer', auth, preview, dataLayer } = props + const { gtmId, dataLayerName = 'dataLayer', auth, preview, dataLayer, url } = props if (currDataLayerName === undefined) { currDataLayerName = dataLayerName @@ -17,7 +17,7 @@ export function GoogleTagManager(props: GTMParams) { const gtmLayer = dataLayerName !== 'dataLayer' ? `&l=${dataLayerName}` : '' const gtmAuth = auth ? `>m_auth=${auth}` : '' const gtmPreview = preview ? `>m_preview=${preview}>m_cookies_win=x` : '' - + const gtmUrl = url ? url : 'https://www.googletagmanager.com' useEffect(() => { // performance.mark is being used as a feature use signal. While it is traditionally used for performance // benchmarking it is low overhead and thus considered safe to use in production and it is a widely available @@ -47,7 +47,7 @@ export function GoogleTagManager(props: GTMParams) {