3

I want to prevent goal from triggering multiple times.

What should I do?

Any suggest?

Thank you.

I tried:

The rule doesn't work!

The rule doesn't work!

4
  • Mark Cassidy answered on the same question here Commented Nov 16, 2017 at 9:06
  • you mean trigger one goal for one contact one time ? Commented Nov 16, 2017 at 9:32
  • @SitecoreClimber Yes.No matter how to refresh the page, It only add up the engagement value one time for the contact.
    – Gray
    Commented Nov 17, 2017 at 0:16
  • @AndreiPaliakou Thank you for your reply. Does I have to create a Engagement Plan?
    – Gray
    Commented Nov 17, 2017 at 0:29

1 Answer 1

3

Assumption

Once the goal has been triggered by a visitor, the visitor cannot trigger the same goal.

Solution

If you are triggering the goal programmatically, you can check if the user has already trigger the goal. The below snippet can be used to check if the goal has been triggered.

Guid goalId = // your goal ID
KeyBehaviorCache cache = Sitecore.Analytics.Tracker.Current.Contact.GetKeyBehaviorCache();
bool goalTriggered = cache.Goals.Any(a => a.Id == goalId);

If the goal is being triggered via rules, implement a new rule to perform the check if the goal has been triggered.

Moreover, if you are using Outcomes, you can change the above code to check if the user is already assigned a specific outcome.

Guid outcomeId= // your outcome ID
KeyBehaviorCache cache = Sitecore.Analytics.Tracker.Current.Contact.GetKeyBehaviorCache();
bool isAssociatedOutcome = cache.Outcomes.Any(a => a.Id == outcomeId);
1
  • 1
    I know this is an old answer, but it would be nice to have an updated answer with how to accomplish the same in Sitecore 9, as KeyBehaviorCache has been deprecated. Commented Jan 11, 2019 at 12:15

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.