function addGoogleAnalyticsTags() { const currentOrigin = window.location.origin; const allowedOrigins = [ "https://eaglercraftx1-8.github.io", "https://eaglercraftx1-8.netlify.app", "https://eaglercraftx1-8.onrender.com", "https://fastest.eaglercraft.win", "https://notproxiedclient.eaglercraft.win", "https://client.eaglercraft.win", "https://client2.eaglercraft.win", "https://client3.eaglercraft.win" ]; const trackingIds = { "https://eaglercraftx1-8.github.io": "G-C44R8LD9MC", "https://eaglercraftx1-8.netlify.app": "G-0R2ZXFSYVT", "https://eaglercraftx1-8.onrender.com": "G-MND1TVBSXV", "https://fastest.eaglercraft.win": "G-0FMCWKD9KG", "https://notproxiedclient.eaglercraft.win": "G-QWHQVSNLB6", "https://client.eaglercraft.win": "G-SGELV1H17J", "https://client2.eaglercraft.win": "G-995EPK8DXR", "https://client3.eaglercraft.win": "G-3M7CR3HRJV" }; let trackingId = "G-81F615LDEZ"; // Default fallback tracking ID if (allowedOrigins.includes(currentOrigin)) { trackingId = trackingIds[currentOrigin]; } console.log("Current Origin:", currentOrigin); // Log the origin to debug console.log("Using Tracking ID:", trackingId); // Log the tracking ID to debug if (trackingId) { const analyticsScript = document.createElement('script'); analyticsScript.async = true; analyticsScript.src = `https://www.googletagmanager.com/gtag/js?id=${trackingId}`; document.head.appendChild(analyticsScript); const scriptContent = document.createElement('script'); scriptContent.innerHTML = ` window.dataLayer = window.dataLayer || []; function gtag(){dataLayer.push(arguments);} gtag('js', new Date()); gtag('config', '${trackingId}'); `; document.head.appendChild(scriptContent); } } addGoogleAnalyticsTags();