public void Process(AnalyticsPipelineArgs args) { Assert.ArgumentNotNull(args, "args"); Assert.ArgumentNotNull(args.RulesFolderID, "args.RulesFolderID"); Assert.IsFalse(args.RulesFolderID.IsNull, "args.RulesFolderID.IsNull"); ProfilesPipelineArgs profilesArgs = args as ProfilesPipelineArgs; if (args.ContextItem == null) return; //Execute rules here to get the below goalsFolders AnalyticsRuleContext ruleContext = new AnalyticsRuleContext() { Item = args.ContextItem, RulesFolderID = args.RulesFolderID }; RulesManager.RunRules(ruleContext); if (ruleContext.AnalyticsFolders == null || ruleContext.AnalyticsFolders.Count == 0) ruleContext.AnalyticsFolders.Add(GetDefaultProfilesRoot(profilesArgs.ContextItem)); List<ProfileItem> profiles = new List<ProfileItem>(); foreach (Item profilesRoot in ruleContext.AnalyticsFolders) { profiles.AddRange(profilesRoot.Database.Analytics(profilesRoot.Language).Profiles .Where(p => ((Item) p).TemplateID == AnalyticsIds.Profile) .Where(p => ((Item)p).Paths.FullPath.StartsWith(profilesRoot.Paths.FullPath, StringComparison.OrdinalIgnoreCase))); } profilesArgs.Profiles = profiles; }
public void Process(AnalyticsPipelineArgs args) { Assert.ArgumentNotNull(args, "args"); Assert.ArgumentNotNull(args.RulesFolderID, "args.RulesFolderID"); Assert.IsFalse(args.RulesFolderID.IsNull, "args.RulesFolderID.IsNull"); GoalsPipelineArgs goalsArgs = args as GoalsPipelineArgs; goalsArgs.PageEvents = Tracker.DefinitionItems.AllPageEvents.Where(e => e.IsDeployed && !e.IsSystem && e.IsGoal); if (args.ContextItem == null) return; //Execute rules here to get the below goalsFolders AnalyticsRuleContext ruleContext = new AnalyticsRuleContext() { Item = args.ContextItem, RulesFolderID = args.RulesFolderID }; RulesManager.RunRules(ruleContext); if (ruleContext.AnalyticsFolders != null && ruleContext.AnalyticsFolders.Count > 0) { var analyticsFolders = ruleContext.AnalyticsFolders.Select(e => e.Paths.FullPath).ToList(); goalsArgs.PageEvents = goalsArgs.PageEvents.Where(e => analyticsFolders.Exists(gf => e.InnerItem.Paths.FullPath.StartsWith(gf))); } }