Skip to content

Commit d43dffa

Browse files
DanLDUDan Larrea
andauthored
fix(gtm): expose gtag globally (#524)
Co-authored-by: Dan Larrea <[email protected]>
1 parent f53dc7e commit d43dffa

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

src/runtime/registry/google-tag-manager.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -167,6 +167,9 @@ export function useScriptGoogleTagManager<T extends GoogleTagManagerApi>(
167167
(window as any)[dataLayerName].push(arguments)
168168
}
169169

170+
// Assign gtag to window for global access
171+
(window as any).gtag = gtag
172+
170173
// Allow custom initialization
171174
options?.onBeforeGtmStart?.(gtag);
172175

0 commit comments

Comments
 (0)