public IViewComponentResult Invoke() { var viewModel = new CookieBannerViewModel() { ShowBanner = _cookieSettingsProvider.GetPreferencesForCurrentUser() == null, ShowAcceptedMessage = TempData["AcceptedAllCookies"] != null }; return(View("~/Features/Cookies/CookieBanner.cshtml", viewModel)); }
public override void Process(TagHelperContext context, TagHelperOutput output) { if (_cookieSettingsProvider.GetPreferencesForCurrentUser()?.AllowAnalyticsCookies == true) { if (output.TagName.Equals("HEAD", StringComparison.OrdinalIgnoreCase)) { output.PreContent.AppendHtml(_headTrackingCode); } else if (output.TagName.Equals("BODY", StringComparison.OrdinalIgnoreCase)) { output.PostContent.AppendHtml(_bodyTrackingCode); } } }
public override void Process(TagHelperContext context, TagHelperOutput output) { if (_cookieSettingsProvider.GetPreferencesForCurrentUser()?.AllowAnalyticsCookies == true) { if (output.TagName.Equals("HEAD", StringComparison.OrdinalIgnoreCase)) { output.PreContent.AppendHtml(GetAnalyticsScripts()); output.PreContent.AppendHtml(GetTagManagerScripts()); } else if (output.TagName.Equals("BODY", StringComparison.OrdinalIgnoreCase)) { output.PreContent.AppendHtml(GetTagManagerNoScript()); } } }