What's new about goals in Sitecore 8

Image

Hello Folks,Disclaimer — All Information in this Blog is using Sitecore 8 Technical Preview. So, it may change upon final releaseI recently got the opportunity to play around with Sitecore 8 and hence thought about sharing some exciting new features of Sitecore 8 Experience Platform. Since there is a lot of exciting stuff in SItecore 8, I chose to focus on specific areas of Experience Platform and the topic for this post is Goals.1. Customer Intelligence Options A new section has been added to the Goal Item (/sitecore/system/Marketing Center/Goals/) with the name Customer Intelligence Options.There are 3 fields on the sections and they are

Track as latest event

Once the goal is triggered by the contact (visitor) it appears in the Latest Events panel in the Contact tab.

Show in events

When this event is triggered by the contact (visitor) it appears in the list of Events shown in the Visits tab.

Event image

Associates an image with an event.

The below image shows the new customer intelligence section on the Goal Item[caption id="attachment_660" align="aligncenter" width="660"]

Goal Item

Goal Item[/caption] As you can see below that the contact card will display the Goal information if you checked the field "Track as Latest Event" on the goal[caption id="attachment_663" align="aligncenter" width="660"]

Experience Profile Contact

Contact Card[/caption]As you can see below that the contact card will display the Goal information if you checked the field "Show in Events" on the goal item[caption id="attachment_666" align="aligncenter" width="660"]

Experience Profile2

Contact Card 2[/caption]2. API Changes : Triggering a Goal ProgramaticallyThere also have been changes to the API for triggering goal in Sitecore 8, The below method shows an updated way to trigger a goal programatically[sourcecode language="csharp"] if (Sitecore.Analytics.Tracker.IsActive && Sitecore.Analytics.Tracker.Current.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.Model.PageEventData eventData = Sitecore.Analytics.Tracker.Current.CurrentPage.Register(registerthegoal); eventData.Data = GoaltoTrigger["Description"]; Sitecore.Analytics.Tracker.Current.Interaction.AcceptModifications(); } }[/sourcecode]you could also create an extension method for triggering/registering a goal.[sourcecode language="csharp"] public static void TriggerGoal(string GoalName, string Description) { if (Sitecore.Analytics.Tracker.IsActive && Sitecore.Analytics.Tracker.Current.CurrentPage != null) { Sitecore.Analytics.Tracker.Current.CurrentPage.Register(GoalName, Description); } }[/sourcecode]Stay tuned for more exciting postsShould you have any questions, Please do not hesitate to comment below