Created
November 27, 2016 19:29
-
-
Save BenGGolden/1f21431c35388b2d3b95726393305b56 to your computer and use it in GitHub Desktop.
Sitecore rule engine action to register a goal
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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