fix(analytics): gtag shim kanonik arguments push #253

Merged
root merged 1 commits from dev into main 2026-08-01 10:09:44 +03:00

View File

@@ -39,9 +39,15 @@ export function initGoogleAds(): void {
_adsId = id;
window.dataLayer = window.dataLayer || [];
const gtag: (...args: GtagArgs) => void = (...args) => {
window.dataLayer?.push(args);
};
// gtag.js executes only queue entries that are the `arguments` object; pushing a
// plain array (rest params → `args`) is stored as inert dataLayer data and the
// command (config/event) NEVER runs. That silently disabled ALL conversion
// tracking — no _gcl_aw linker cookie, no conversion pings, 0 conversions in the
// panel. Use Google's canonical snippet form that pushes `arguments`.
function gtag() {
// biome-ignore lint/style/noArguments: gtag.js only processes the raw arguments object
window.dataLayer?.push(arguments as unknown as GtagArgs);
}
if (!window.gtag) window.gtag = gtag;
const script = document.createElement("script");