diff --git a/catalog/app/app.tsx b/catalog/app/app.tsx index ae417dfac70..41e2e974a44 100644 --- a/catalog/app/app.tsx +++ b/catalog/app/app.tsx @@ -25,7 +25,6 @@ import 'sanitize.css' import * as Intercom from 'components/Intercom' import Placeholder from 'components/Placeholder' import App from 'containers/App' -import GTMLoader from 'utils/gtm' import * as Auth from 'containers/Auth' import * as Errors from 'containers/Errors' import * as Notifications from 'containers/Notifications' @@ -105,7 +104,6 @@ const render = () => { Notifications.Provider, [APIConnector.Provider, { fetch, middleware: [Auth.apiMiddleware] }], [Auth.Provider, { storage }], - [GTMLoader, { gtmId: cfg.gtmId }], [ Intercom.Provider, { diff --git a/catalog/app/utils/Config.ts b/catalog/app/utils/Config.ts index 7df67ecd5e8..977015fe6a7 100644 --- a/catalog/app/utils/Config.ts +++ b/catalog/app/utils/Config.ts @@ -24,7 +24,6 @@ export interface ConfigJson { registryUrl: string s3Proxy: string - gtmId?: string intercomAppId?: string mixpanelToken: string sentryDSN?: string diff --git a/catalog/app/utils/gtm.tsx b/catalog/app/utils/gtm.tsx deleted file mode 100644 index 95ff9a9fac4..00000000000 --- a/catalog/app/utils/gtm.tsx +++ /dev/null @@ -1,68 +0,0 @@ -import invariant from 'invariant' -import * as React from 'react' - -interface SupportedAttrs { - async?: boolean - innerText: string - src: string -} - -function addScript(props: Pick): HTMLScriptElement -function addScript(props: Pick): HTMLScriptElement -function addScript({ async, innerText, src }: Partial) { - const s = window.document.createElement('script') - s.type = 'text/javascript' - - if (innerText) { - s.innerText = innerText - } - if (async) { - s.async = async - } - if (src) { - s.src = src - } - const x = window.document.getElementsByTagName('script')[0] - invariant( - x?.parentNode, - 'No SCRIPT or HEAD element was found, is it the DOM environment?', - ) - x.parentNode.insertBefore(s, x) - return s -} - -function removeScript(script: HTMLScriptElement) { - invariant( - script.parentNode, - 'No SCRIPT or HEAD element was found, is it the DOM environment?', - ) - script.parentNode.removeChild(script) -} - -interface GTMLoaderProps { - children: React.ReactNode - gtmId: string -} - -export default function GTMLoader({ children, gtmId }: GTMLoaderProps) { - React.useEffect(() => { - if (!gtmId) return - const gtmMain = addScript({ - async: true, - src: `https://www.googletagmanager.com/gtag/js?id=${gtmId}`, - }) - const gtmInit = addScript({ - innerText: ` - window.dataLayer = window.dataLayer || []; - function gtag(){dataLayer.push(arguments);} - gtag('js', new Date()); - gtag('config', '${gtmId}'); - `.replace(/\n/g, ' '), - }) - return () => { - removeScript(gtmMain) - removeScript(gtmInit) - } - }, [gtmId]) - return <>{children} -} diff --git a/catalog/config-schema.json b/catalog/config-schema.json index 944f9a8307a..8c7aabc219e 100644 --- a/catalog/config-schema.json +++ b/catalog/config-schema.json @@ -93,10 +93,6 @@ "type": "string", "description": "Optional" }, - "gtmId": { - "type": "string", - "description": "ID for Google TagManager/Analytics service" - }, "qurator": { "type": "boolean", "description": "Enable Qurator AI Assistant (powered by AWS Bedrock)" diff --git a/docs/CHANGELOG.md b/docs/CHANGELOG.md index c677dacf3ec..5c7f9674df3 100644 --- a/docs/CHANGELOG.md +++ b/docs/CHANGELOG.md @@ -30,6 +30,7 @@ Entries inside each section should be ordered by type: ## Catalog, Lambdas * [Removed] Drop MARKETING mode support, delete associated dead code ([#4009](https://github.com/quiltdata/quilt/pull/4009)) +* [Removed] Delete Google Tag Manager script integration ([#4039](https://github.com/quiltdata/quilt/pull/4039)) * [Added] Support multiple roles per user ([#3982](https://github.com/quiltdata/quilt/pull/3982)) * [Added] Add `ui.actions = False` and `ui.actions.writeFile` for configuring visibility of buttons ([#4001](https://github.com/quiltdata/quilt/pull/4001)) * [Added] Support creating folders and rearranging entries with drag and drop in package creation dialog ([#3999](https://github.com/quiltdata/quilt/pull/3999))