diff --git a/Lombiq.BaseTheme.Samples/Lombiq.BaseTheme.Samples.csproj b/Lombiq.BaseTheme.Samples/Lombiq.BaseTheme.Samples.csproj index 84b8954..1e8f7af 100644 --- a/Lombiq.BaseTheme.Samples/Lombiq.BaseTheme.Samples.csproj +++ b/Lombiq.BaseTheme.Samples/Lombiq.BaseTheme.Samples.csproj @@ -26,8 +26,8 @@ - - + + diff --git a/Lombiq.BaseTheme/Lombiq.BaseTheme.csproj b/Lombiq.BaseTheme/Lombiq.BaseTheme.csproj index e042db1..7baec38 100644 --- a/Lombiq.BaseTheme/Lombiq.BaseTheme.csproj +++ b/Lombiq.BaseTheme/Lombiq.BaseTheme.csproj @@ -42,12 +42,12 @@ - - - - - - + + + + + + diff --git a/Lombiq.BaseTheme/ViewModels/GoogleTagViewModel.cs b/Lombiq.BaseTheme/ViewModels/GoogleTagViewModel.cs deleted file mode 100644 index ba746d7..0000000 --- a/Lombiq.BaseTheme/ViewModels/GoogleTagViewModel.cs +++ /dev/null @@ -1,10 +0,0 @@ -using OrchardCore.DisplayManagement.Views; - -namespace Lombiq.BaseTheme.ViewModels; - -public class GoogleTagViewModel : ShapeViewModel -{ - public string GoogleTagPropertyId { get; set; } - public string CookieDomain { get; set; } - public GoogleTagViewModel() => Metadata.Type = "GoogleTag"; -} diff --git a/Lombiq.BaseTheme/Views/GoogleTag.cshtml b/Lombiq.BaseTheme/Views/GoogleTag.cshtml deleted file mode 100644 index 38b5c5e..0000000 --- a/Lombiq.BaseTheme/Views/GoogleTag.cshtml +++ /dev/null @@ -1,38 +0,0 @@ -@model dynamic - -@using Lombiq.HelpfulLibraries.OrchardCore.Security -@using Microsoft.AspNetCore.Http.Features; -@using Microsoft.Extensions.Hosting; -@using Lombiq.BaseTheme.ViewModels - -@inject IHostEnvironment HostEnvironment - -@{ - var trackingConsentFeature = ViewContext.HttpContext.Features.Get(); -} - -@if (HostEnvironment.IsProduction() && (trackingConsentFeature is null || trackingConsentFeature.CanTrack)) -{ - GoogleAnalyticsContentSecurityPolicyProvider.EnableForCurrentRequest(Context); - - var viewModel = Model as GoogleTagViewModel ?? new GoogleTagViewModel - { - GoogleTagPropertyId = Model.GoogleTagPropertyId, - CookieDomain = Model.CookieDomain, - }; - var cookieDomain = string.Empty; - - if (!string.IsNullOrEmpty(viewModel.CookieDomain)) - { - cookieDomain = $", {{'cookie_domain': '{viewModel.CookieDomain}' }}"; - } - - - -}