Diferencia entre revisiones de «MediaWiki:Common.js»
De Dicionário de História Cultural de la Iglesía en América Latina
Ir a la navegaciónIr a la búsqueda| Línea 5: | Línea 5: | ||
scriptElement.src = "https://www.googletagmanager.com/gtag/js?id=G-BLPMLEYW7K"; | scriptElement.src = "https://www.googletagmanager.com/gtag/js?id=G-BLPMLEYW7K"; | ||
var scriptElement2 = document.createElement("script"); | var scriptElement2 = document.createElement("script"); | ||
| − | scriptElement2.textContent = | + | scriptElement2.textContent = " |
window.dataLayer = window.dataLayer || []; | window.dataLayer = window.dataLayer || []; | ||
function gtag(){dataLayer.push(arguments);} | function gtag(){dataLayer.push(arguments);} | ||
gtag('js', new Date()); | gtag('js', new Date()); | ||
gtag('config', 'G-BLPMLEYW7K'); | gtag('config', 'G-BLPMLEYW7K'); | ||
| − | + | "; | |
// Adjuntar el elemento <script> al final del <head> del documento | // Adjuntar el elemento <script> al final del <head> del documento | ||
document.head.appendChild(scriptElement); | document.head.appendChild(scriptElement); | ||
document.head.appendChild(scriptElement2); | document.head.appendChild(scriptElement2); | ||
Revisión del 11:13 16 ago 2023
/* Cualquier código JavaScript escrito aquí se cargará para todos los usuarios en cada carga de página */
// Crear el elemento <script> para la carga de gtag.js
var scriptElement = document.createElement("script");
scriptElement.async = true;
scriptElement.src = "https://www.googletagmanager.com/gtag/js?id=G-BLPMLEYW7K";
var scriptElement2 = document.createElement("script");
scriptElement2.textContent = "
window.dataLayer = window.dataLayer || [];
function gtag(){dataLayer.push(arguments);}
gtag('js', new Date());
gtag('config', 'G-BLPMLEYW7K');
";
// Adjuntar el elemento <script> al final del <head> del documento
document.head.appendChild(scriptElement);
document.head.appendChild(scriptElement2);