Last active
April 16, 2021 13:48
-
-
Save chodorowicz/5f1b1e563b45aefe1b68f090699dc661 to your computer and use it in GitHub Desktop.
TypeScript + Google Analytics = ❤️
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function initAnalytics() { | |
(function(i,s,o,g,r,a,m) {i["GoogleAnalyticsObject"]=r;i[r]=i[r]||function() { | |
(i[r].q=i[r].q ||[]).push(arguments);},i[r].l= 1*new Date();a=s.createElement(o), | |
m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m); | |
})(window, document, "script", "//www.google-analytics.com/analytics.js", "ga"); | |
ga("create", "UA-XXXXXXXX-X", "auto"); | |
ga("send", "pageview"); | |
} | |
export { initAnalytics }; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* tslint:disable ban-comma-operator only-arrow-functions */ | |
function initAnalytics() { | |
(function(i, s, o, g, r, a, m) { | |
i["GoogleAnalyticsObject"] = r; | |
(i[r] = | |
i[r] || | |
function() { | |
(i[r].q = i[r].q || []).push(arguments); | |
}), | |
(i[r].l = 1 * new Date()); | |
(a = s.createElement(o)), (m = s.getElementsByTagName(o)[0]); | |
a.async = 1; | |
a.src = g; | |
m.parentNode.insertBefore(a, m); | |
})(window, document, "script", "//www.google-analytics.com/analytics.js", "ga"); | |
ga("create", "UA-XXXXXXXX-X", "auto"); | |
ga("send", "pageview"); | |
} | |
export { initAnalytics }; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* tslint:disable ban-comma-operator only-arrow-functions */ | |
function initAnalytics() { | |
(function(i, s, o: "script", g, r: "ga", a?: HTMLScriptElement, m?: Element) { | |
i.GoogleAnalyticsObject = r; | |
(i[r] = | |
i[r] || | |
function() { | |
(i[r].q = i[r].q || []).push(arguments); | |
}), | |
(i[r].l = 1 * new Date().getTime()); | |
(a = s.createElement(o)), (m = s.getElementsByTagName(o)[0]); | |
a.async = true; | |
a.src = g; | |
if (m.parentNode !== null) { | |
m.parentNode.insertBefore(a, m); | |
} | |
})(window, document, "script", "//www.google-analytics.com/analytics.js", "ga"); | |
ga("create", "UA-XXXXXXXX-X", "auto"); | |
ga("send", "pageview"); | |
} | |
export { initAnalytics }; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment