diff --git a/DrSousan.Api/Pages/Shared/_Layout.cshtml b/DrSousan.Api/Pages/Shared/_Layout.cshtml index 9157ab0..83be79b 100644 --- a/DrSousan.Api/Pages/Shared/_Layout.cshtml +++ b/DrSousan.Api/Pages/Shared/_Layout.cshtml @@ -6,12 +6,24 @@ .ToListAsync(); var _logoUrl = _identity.FirstOrDefault(s => s.Key == "logo")?.Value ?? ""; var _faviconUrl = _identity.FirstOrDefault(s => s.Key == "favicon")?.Value ?? ""; + var _gaId = (_identity.FirstOrDefault(s => s.Key == "ga_id")?.Value ?? "").Trim(); } + @if (!string.IsNullOrEmpty(_gaId)) + { + + + + } @RenderSection("Head", required: false) diff --git a/DrSousan.Api/wwwroot/admin/index.html b/DrSousan.Api/wwwroot/admin/index.html index 290316f..b3179d3 100644 --- a/DrSousan.Api/wwwroot/admin/index.html +++ b/DrSousan.Api/wwwroot/admin/index.html @@ -630,6 +630,26 @@ tr:hover td{background:#FAFBFC}

⚠️ پس از ذخیره، تغییرات فاویکون ممکن است نیاز به پاک‌کردن کش مرورگر داشته باشد.

+ + +
+
📊 گوگل آنالیتیکس (Google Analytics)
+ +
@@ -1464,6 +1484,7 @@ async function loadSiteIdentity() { // Set hidden inputs document.getElementById('si-logo').value = vals.logo || ''; document.getElementById('si-favicon').value = vals.favicon || ''; + document.getElementById('si-ga').value = vals.ga_id || ''; // Show previews showPreview('prev-si-logo', vals.logo || ''); showPreview('prev-si-favicon', vals.favicon || ''); @@ -1486,9 +1507,10 @@ function updateSiteIdentityPreview(logoUrl, faviconUrl) { async function saveSiteIdentity() { const logo = document.getElementById('si-logo').value; const favicon = document.getElementById('si-favicon').value; + const ga_id = (document.getElementById('si-ga').value || '').trim(); await api('/api/settings/identity', { method: 'PUT', - body: JSON.stringify({ settings: { logo, favicon } }) + body: JSON.stringify({ settings: { logo, favicon, ga_id } }) }); updateSiteIdentityPreview(logo, favicon); toast('ذخیره شد ✓ — برای اعمال فاویکون کش مرورگر را پاک کنید');