feat: enable Google Tag Manager on cloud version only - #5083
Merged
Conversation
Mounts the existing cloud-gated Analytics component (GTM + HubSpot script loader) in _app.tsx. It was already implemented behind api.settings.isCloud but never wired into the app, so it never loaded on cloud or self-hosted instances.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Mounts the existing
Analyticscomponent (components/shared/analytics.tsx) in_app.tsx. That component already loads Google Tag Manager (GTM-PWBFB2V2, same container used on dokploy.com) and the HubSpot script gated behindapi.settings.isCloud, but it was never mounted anywhere, so it never actually ran.Verified locally with Playwright by toggling
IS_CLOUDin.env:IS_CLOUD=false: nodataLayer, no GTM/HubSpot scripts injected, no requests to google.com/hubapi.com.IS_CLOUD=true: GTM loads,dataLayerpopulates withgtm.js/gtm.dom/gtm.load, HubSpot script loads, and GTM's configured tags fire real network requests.Greptile Summary
Mounts the existing analytics component globally so Google Tag Manager and HubSpot run only in cloud deployments.
Analyticsimport to the application entry point.Confidence Score: 5/5
The PR appears safe to merge with analytics remaining disabled for self-hosted deployments.
The mounted component receives its required router and tRPC contexts, handles unresolved or failed cloud-setting queries by rendering nothing, and injects third-party scripts only when the server reports a cloud deployment.
Reviews (1): Last reviewed commit: "feat: enable Google Tag Manager on cloud..." | Re-trigger Greptile