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 4: | Línea 4: | ||
scriptElement.async = true; | scriptElement.async = true; | ||
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"); | ||
| + | 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 | // Adjuntar el elemento <script> al final del <head> del documento | ||
document.head.appendChild(scriptElement); | document.head.appendChild(scriptElement); | ||
| − | + | document.head.appendChild(scriptElement2); | |
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
Revisión del 11:10 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);