Skip to content

Commit

Permalink
Hexlet#649 add couters.ts
Browse files Browse the repository at this point in the history
  • Loading branch information
kodsurfer committed Sep 6, 2024
1 parent 4a2a92b commit 0f1f808
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions public/assets/js/couters.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
(function(w: Window, d: Document, s: string, l: string, i: string): void {
w[l] = w[l] || [];
w[l].push({'gtm.start': new Date().getTime(), event: 'gtm.js'});
const f: HTMLScriptElement = d.getElementsByTagName(s)[0];
const j: HTMLScriptElement = d.createElement(s);
const dl: string = l !== 'dataLayer' ? '&l=' + l : '';
j.async = true;
j.src = 'https://www.googletagmanager.com/gtm.js?id=' + i + dl;
f.parentNode.insertBefore(j, f);
})(window, document, 'script', 'dataLayer', 'GTM-KMJ8HKG');

0 comments on commit 0f1f808

Please sign in to comment.