MediaWiki:Common.js: Difference between revisions
Created page with "→Google Analytics: (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','https://www.google-analytics.com/analytics.js','ga'); ga('create', 'UA-253409-3', 'auto'); ga('send', 'pageview');" |
No edit summary |
||
(8 intermediate revisions by the same user not shown) | |||
Line 1: | Line 1: | ||
function inject(url) { | |||
var script = document.createElement("script"); | |||
script.src = url; | |||
script.defer = true; | |||
} | document.head.appendChild(script); | ||
} | |||
/* Google Analytics v4 */ | |||
window.dataLayer = []; | |||
window.gtag = function() { | |||
window.dataLayer.push(arguments); | |||
} | |||
gtag("js", new Date()); | |||
gtag("config", "G-JKLRL9CMTE"); | |||
inject("https://www.googletagmanager.com/gtag/js?id=G-JKLRL9CMTE"); | |||
/* Yandex Metrika */ | |||
window.ym = function () { | |||
ym.a.push(arguments); | |||
}; | |||
ym.a = []; | |||
ym.l = Date.now(); | |||
ym(93598126, "init", { | |||
clickmap: true, | |||
trackLinks: true, | |||
accurateTrackBounce: true | |||
}); | |||
inject("https://mc.yandex.ru/metrika/tag.js"); |
Latest revision as of 16:42, 2 June 2023
function inject(url) { var script = document.createElement("script"); script.src = url; script.defer = true; document.head.appendChild(script); } /* Google Analytics v4 */ window.dataLayer = []; window.gtag = function() { window.dataLayer.push(arguments); } gtag("js", new Date()); gtag("config", "G-JKLRL9CMTE"); inject("https://www.googletagmanager.com/gtag/js?id=G-JKLRL9CMTE"); /* Yandex Metrika */ window.ym = function () { ym.a.push(arguments); }; ym.a = []; ym.l = Date.now(); ym(93598126, "init", { clickmap: true, trackLinks: true, accurateTrackBounce: true }); inject("https://mc.yandex.ru/metrika/tag.js");