3

We have a number of goals that can be completed by anonymous users, which we use to do things like measure campaign penetration, etc. Because these goals are anonymous, they are not true "conversions" which IMHO would involve turning an anonymous visitor into a known contact.

How can you use Sitecore to differentiate between anonymous goals and actual conversion goals?

2 Answers 2

1

Out of the box, the Sitecore UI has no way of knowing how to trigger goals if Identified or not.

In code, you can check the property Sitecore.Analytics.Tracker.Current.Session.Contact.Identifiers.Identifier to see if the current user is identified or not.

Then you can fire your goal in code

if (Sitecore.Analytics.Tracker.IsActive && Sitecore.Analytics.Tracker.CurrentPage != null)
{
   Sitecore.Data.Items.Item GoaltoTrigger = Sitecore.Context.Database.GetItem("{Item ID of the Goal}");
   if(GoaltoTrigger!=null)
   {
      Sitecore.Analytics.Data.Items.PageEventItem registerthegoal = new Sitecore.Analytics.Data.Items.PageEventItem(GoaltoTrigger);
      Sitecore.Analytics.Data.DataAccess.DataSets.VisitorDataSet.PageEventsRow eventData = Sitecore.Analytics.Tracker.CurrentPage.Register(registerthegoal);
      eventData.Data = GoaltoTrigger["Description"];
      Sitecore.Analytics.Tracker.Submit();
   }
}

Doing it this way, in code only, is a tough way to go. But if you want to track it separately, identified vs not, you need to fire one vs the other based on identification.

Your other choices are to hide components with a custom rule and place the goal on your identified or un-identified rendering. Or to hide your conversion based goals behind a login screen.

1
  • I like the use of personalization rules to expose components with different goals based on whether the user was anonymous. That's clever. In my case, we have most of the goals set on pages, not components, so we'd have to adjust the page visit logic a bit. Oct 9, 2017 at 13:38
1

Sitecore creates a contact id for each user session. In order to know if the goal triggered is anonymous or not, you will need to check whether the contact who has triggered the goal has already been identified as a known contact or not.

Example

User A is Anonymous when entering the site. Sitecore gives User A an Interaction and a Contact Id. If User A is authenticated (through login / registration) and triggers some goals, when you check in the conversion table, you will see the Contact Id. With the Contact Id, you can check if Sitecore has already identified the user.

If the user has not been identified, then the goal that has been triggered can be said as "Anonymous Goal"

Your Answer

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

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