Skip to content

Commit f6de40f

Browse files
bjaggCopilot
andauthored
Update frontends/lif_advisor_app/src/utils/analytics.ts
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
1 parent 9d0ebcb commit f6de40f

1 file changed

Lines changed: 5 additions & 3 deletions

File tree

frontends/lif_advisor_app/src/utils/analytics.ts

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,11 @@ function loadGtag(): void {
1616
document.head.appendChild(script);
1717

1818
window.dataLayer = window.dataLayer || [];
19-
// Must use `arguments` (not rest params) — gtag.js checks for Arguments objects in dataLayer
20-
// eslint-disable-next-line @typescript-eslint/no-explicit-any, prefer-rest-params
21-
window.gtag = function () { (window.dataLayer as any[]).push(arguments); } as any;
19+
// gtag.js expects the `arguments` object to be pushed into dataLayer (not a rest-parameter array)
20+
// eslint-disable-next-line prefer-rest-params
21+
window.gtag = function () {
22+
window.dataLayer.push(arguments);
23+
};
2224
window.gtag('js', new Date());
2325
window.gtag('config', MEASUREMENT_ID, { anonymize_ip: true });
2426
}

0 commit comments

Comments
 (0)