Uh oh!
There was an error while loading. Please reload this page.
[WEB-4193] Refresh GTM - #2400
Conversation
Important Review skippedAuto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the You can disable this status message by setting the 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File ( |
fef51e5 to
b16bfbaCompareb16bfba to
0bf727dCompareTurned into TypeScript and got rid of the minified JS because we compile ourselves, and also fixed the issue where the container is hardcoded and we switch on/off based on auth tokens & env which are testing concerns.
0bf727d to
7913cebComparekennethkalmer
commented
Jan 27, 2025
Closing this off in favour of #2403. |
Description
Some issues with GTM/GA on our production site, and this helps to modernise things a little as part of the process.
See WEB-4193,
Copilot summary
This pull request includes several changes to update the Google Tag Manager (GTM) integration and refactor the related code. The most important changes include updating the schema and configuration for GTM, refactoring the GTM script injection, and modifying the
GlobalLoadingcomponent to use the newGoogleTagManagerFallbackcomponent.Schema and configuration updates:
data/onCreateNode/create-graphql-schema-customization.ts: ReplacedgoogleTagManagerAuthTokenwithgtmContainerIdandgtmAuthTokenin theExternalScriptDatatype.gatsby-config.ts: Updated thesiteMetadatato includegtmContainerIdandgtmAuthTokeninstead ofgoogleTagManagerAuthToken.Component updates:
src/components/GlobalLoading/GlobalLoading.tsx: Updated theGlobalLoadingcomponent to usegtmContainerIdandgtmAuthTokenand replaced the inline GTM iframe with theGoogleTagManagerFallbackcomponent. [1][2][3]Script injection refactoring:
src/external-scripts/google-tag-manager.tsx: Created a newGoogleTagManagerFallbackcomponent and refactored thegoogleTagManagerfunction to usecontainerId,authToken, andpreview.src/external-scripts/index.ts: Updated theinjectScriptsandsessionTrackerfunctions to use the new GTM parameters and refactored the code for better type safety and maintainability. [1][2][3][4][5][6][7]Type updates:
src/external-scripts/inkeep.ts: Exported theInkeepUsertype for use in other modules.Review
Instructions on how to review the PR.