Merge pull request 'fix(analytics): gtag shim kanonik arguments push' (#253) from dev into main
This commit was merged in pull request #253.
This commit is contained in:
@@ -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");
|
||||
|
||||
Reference in New Issue
Block a user