public ActionResult Widget(Include include) { var gaInclude = new GA4AtomSiteInclude(include); if (string.IsNullOrEmpty(gaInclude.GoogleAccountID)) return new EmptyResult(); return PartialView("GA4AtomSiteWidget", new GA4AtomSiteModel { GoogleAccountID = gaInclude.GoogleAccountID }); }
public override void Register(IContainer container, List<SiteRoute> routes, ViewEngineCollection viewEngines, ModelBinderDictionary modelBinders, ICollection<Asset> globalAssets) { RegisterWidget(container, new CompositeWidget("GA4AtomSiteWidget", "GA4AtomSite", "Widget") { Description = "This widget adds Google Analytics tracking code to the page, that is capable of tracking javascript disabled browsers as well.", SupportedScopes = SupportedScopes.All, OnGetConfigInclude = (p) => new ConfigLinkInclude(p, "GA4AtomSite", "Config"), OnValidate = (i) => { var gaInclude = new GA4AtomSiteInclude(i); return !string.IsNullOrEmpty(gaInclude.GoogleAccountID); }, AreaHints = new[] { "foot", "tail" } }); RegisterController<GA4AtomSiteController>(container); }