Diferencia entre revisiones de «MediaWiki:Common.js»
De Amereida
(Página creada con «→Cualquier código JavaScript escrito aquí se cargará para todos los usuarios en cada carga de página: →Google Analytics: // Código para el <head> (function(w...») |
|||
| Línea 2: | Línea 2: | ||
/* Google Analytics */ | /* Google Analytics */ | ||
| + | ;(function(){ | ||
| + | // Cargar el script de Google Analytics | ||
| + | var script = document.createElement('script'); | ||
| + | script.async = true; | ||
| + | script.src = 'https://www.googletagmanager.com/gtag/js?id=G-16RVN5DC93'; | ||
| + | document.head.appendChild(script); | ||
| − | // | + | // Configurar Google Analytics |
| − | + | window.dataLayer = window.dataLayer || []; | |
| − | + | function gtag(){dataLayer.push(arguments);} | |
| − | + | gtag('js', new Date()); | |
| − | + | gtag('config', 'G-16RVN5DC93'); | |
| − | + | })(); | |
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
Revisión actual del 18:40 13 ene 2025
/* Cualquier código JavaScript escrito aquí se cargará para todos los usuarios en cada carga de página */
/* Google Analytics */
;(function(){
// Cargar el script de Google Analytics
var script = document.createElement('script');
script.async = true;
script.src = 'https://www.googletagmanager.com/gtag/js?id=G-16RVN5DC93';
document.head.appendChild(script);
// Configurar Google Analytics
window.dataLayer = window.dataLayer || [];
function gtag(){dataLayer.push(arguments);}
gtag('js', new Date());
gtag('config', 'G-16RVN5DC93');
})();