Create a gist now

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Sitecore rule engine action to register a goal
public class RegisterGoalAction<T> : RuleAction<T> where T : RuleContext
{
public ID GoalId { get; set; }
public override void Apply(T ruleContext)
{
if (!Tracker.IsActive || Tracker.Current.CurrentPage == null) return;
var goal = (PageEventItem)Context.Database.GetItem(GoalId);
if (goal != null)
{
Tracker.Current.CurrentPage.Register(goal);
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment