3

I have created a goal that should trigger when user visits the 'Booking' page. In its Rules section, added a new rule as:

where the item ID is equal to Booking

Booking is the name of the booking page. Set item ID to the ID of that page. Deployed and published the goal. Visited the booking page a few times in different sessions.

After 2 days, I check the Fact_Conversions table and there is no goal triggered for booking.

For the page item, in the Analyze tab, there is a Goals button, where we can select the goals for that page.

Should this be done instead or both?

Using Sitecore 8.2 update 5

7

Rules are used for something else. You are correct to associate goal instead. Also make sure to deploy goal.

1) Associate goal with an item

To associate a goal with an item, from the Sitecore Launchpad, open the Experience Editor or the Content Editor, then navigate to the relevant content item.

  • In the Attributes group, click Goals.
  • In the Experience Editor, this is located on the Optimization tab enter image description here
  • In the Content Editor, this is located on the Analyze tab enter image description here
  • In the Goals dialog, select the goal that you want to associate with this item and click OK.

More details can be found in official Sitecore documentation -> https://doc.sitecore.net/sitecore_experience_platform/82/digital_marketing/campaigns/goals__events/associate_a_goal_with_an_item

2) Deploy goal

Also make sure that you have deployed goal.

To deploy the goal, on the Review tab, in the Workflow group, click Deploy on your Goal:

enter image description here

More details can be found in Official Sitecore documentation -> https://doc.sitecore.net/sitecore_experience_platform/82/digital_marketing/campaigns/goals__events/create_and_deploy_a_goal

4

Since you mention rules, if you do want to introduce rules so that you only trigger goal registration if other conditions are true then you can extend the processItem pipeline defined in Sitecore.Analytics.config to programmatically process a custom rules field on the context item:

// check if there are any rules set, if not proceed as normal, otherwise do the below

var context = new RuleContext
{
    Item = args.Item
};    

foreach (Rule<RuleContext> rule in RuleFactory.GetRules<RuleContext>(new[] { args.Item }, "RULES FIELD NAME").Rules)
{
    if (rule.Condition != null)
    {
        var stack = new RuleStack();

        rule.Condition.Evaluate(context, stack);

        if (context.IsAborted)
            continue;

        if ((stack.Count != 0) && ((bool)stack.Pop()))
            // condition met, do something
    }
}

And if the conditions on the rules field are satisfied then add the tracking field of the context item to the TrackingParameters property on the ProcessItemArgs:

args.TrackingParameters.Add(new TrackingField(args.Item["__Tracking"]));

Your processor will also have access to the current interaction in the pipeline args so you could for example say register a goal conversion on the current page but only if the user has not already registered the goal... or basically anything you can come up with in the rules engine.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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