Difference between revisions of "MediaWiki:Common.js"
Jump to navigation
Jump to search
(Created page with "→Any JavaScript here will be loaded for all users on every page load.: $(document).ready(function() { var pageBase = document.getElementById('content'); pageBase.innerHTML...") |
|||
Line 1: | Line 1: | ||
/* Any JavaScript here will be loaded for all users on every page load. */ | /* Any JavaScript here will be loaded for all users on every page load. */ | ||
$(document).ready(function() { | $(document).ready(function() { | ||
− | var | + | var gscript = document.createElement( 'script' ); |
− | + | gscript.setAttribute( 'src', 'https://www.googletagmanager.com/gtag/js?id=G-5V1LKDM2DY' ); | |
− | + | gscript.async = true; | |
+ | $("head").append(gscript); | ||
+ | var gscript2 = document.createElement( 'script' ); | ||
+ | gscript2.innerHTML = "window.dataLayer = window.dataLayer || [];" + "\n" + | ||
+ | "function gtag(){dataLayer.push(arguments);}" + "\n" + | ||
+ | "gtag('js', new Date());" + "\n" + | ||
+ | "gtag('config', 'G-5V1LKDM2DY')\;" ; | ||
+ | $("head").append(gscript2); | ||
}); | }); |
Latest revision as of 13:32, 8 September 2023
/* Any JavaScript here will be loaded for all users on every page load. */ $(document).ready(function() { var gscript = document.createElement( 'script' ); gscript.setAttribute( 'src', 'https://www.googletagmanager.com/gtag/js?id=G-5V1LKDM2DY' ); gscript.async = true; $("head").append(gscript); var gscript2 = document.createElement( 'script' ); gscript2.innerHTML = "window.dataLayer = window.dataLayer || [];" + "\n" + "function gtag(){dataLayer.push(arguments);}" + "\n" + "gtag('js', new Date());" + "\n" + "gtag('config', 'G-5V1LKDM2DY')\;" ; $("head").append(gscript2); });