Sitecore MVT for Beginners

MVT stands for multivariate testing if you are not familiar with the concept and you know A/B testing is more or less the same thing and in the case you have never heard about it, the principle behind it is to expose your web site visitors to multiple variations of the website content/functionalities to TEST  what is the variant that perform better.

It is important to specify that Sitecore generate the TESTS variation server side and it requires XDB enabled to track analytics and to help you to understand the more effective variant.

There are two way that Sitecore use to deliver MVT functionalities:

Component Based Testing

you can configure it either in Page Editor Mode either from the presentation details here you can specify all the variations that you want to expose your customers and it is very easy to configure as you can see in the following screenshots.



Page Based Testing

From here you can control all the running Tests and you can see Sitecore suggestions for the Pages to test…

When you create a new Test you will be asked for the page to Test and the Variations of the page to test (you can either use different pages or create different versions of the same page)

You can than define:

  1. The Percentage of the traffic visiting the page to run the test
  2. The Success criteria of your test (eg. if the user is visiting more pages / increasing the engagement value or if the user is triggering a specific Goal/Event eg. conversion rate
  3. The Duration of your test (for how long you want to run the test)
  4. The confidence level, when do you want Sitecore to decide the winner of the test and serve automatically the winner of the test

Happy Testing!





Create and configure XDB Custom Facet

In this post I am describing the required steps to create a custom facet on XDB and how to use it to personalize the experience…

  • Create your Interface extending IFacet
using System;
using System.Linq;
using Sitecore.Analytics.Model.Framework;

namespace Testing.ContactFacets.Model
    public interface ICRMSegment : IFacet
        string CRMSegmentId { get; set; }
  • Implement your Custom Facet
namespace Testing.ContactFacets.Model
    public class CrmSegment : Facet, ICRMSegment
        private const string FIELD_CRMSegmentId = "CRMSegmentId";
        public CrmSegment()
            base.EnsureAttribute< string>(FIELD_EMPLOYEE_ID);
        public string CRMSegmentId
            get { return base.GetAttribute< string>(FIELD_CRMSegmentId ); }
            set { base.SetAttribute< string>(FIELD_CRMSegmentId , value); }
  • Register your Facet via config file
<configuration xmlns:patch="">
        <element interface="Testing.ContactFacets.Model.ICRMSegment,XXX.AssemblyName " implementation="Testing.ContactFacets.Model.CrmSegment, XXX.AssemblyName" />
            <facet name="CRMSegment" contract="Testing.ContactFacets.Model.ICRMSegment, XXX.AssemblyName" />

  • Create a new XDB Contact
@using Sitecore.Web;
@using Testing.ContactFacets.Model;
@using Sitecore.Analytics.Model.Entities;
 var contact =  Sitecore.Analytics.Tracker.Current.Contact;
 var data = contact.GetFacet<ICRMSegment>("CRMSegment");
 data.CRMSegmentId = "BargainHunter";

var personalInfo = Sitecore.Analytics.Tracker.Current.Contact.GetFacet<Sitecore.Analytics.Model.Entities.IContactPersonalInfo>("Personal");

personalInfo.FirstName = "Stelio";
personalInfo.Surname = "Di Bello";

var contactEmail =  Sitecore.Analytics.Tracker.Current.Contact.GetFacet<IContactEmailAddresses>("Emails");

            // this email to show in the Experience Profiles backend.
 if (!contactEmail.Entries.Contains("Home"))
            // set the email
  var email = contactEmail.Entries["Home"];
  email.SmtpAddress = "";
 contactEmail.Preferred = "Home";

CRM data contact facet updated.

Contact ID: @contact.ContactId.ToString() /b>

Employee #: <b> @data.CRMSegmentId </b>

  • Personalize based on CRMSegmentId rule


  • crmsegmentpersonalisation

Sitecore 8 Personalisation rules for beginners

Probably most of you are already aware of what it means personalisation in Sitecore 8 but in case you have not heard about it, this post will give you a better idea of how Sitecore has implemented it…

Within Sitecore the easier way to deliver a Personalised experience is through Personalisation Rules at Rendering level.

The starting point is defining a page with one rendering and click on the Personalise button


From here you will be able to select your rule:


Once that you have selected your rule, you will than be able to select the actions associated to the conditional rendering that could be setting a different datasource, or Hiding the rendering or displaying a different rendering


Sitecore 8 allows the Developer to customise Rules but OOTB it comes with the following rules to personalise your content:

Sitecore Rules are grouped in the following logical categories:

Campaigns: Condition based on the campaign defined, newsletter, landing page, etc
Channel: Condition based on the channel, web, mobile etc
Date: Condition based on the date & time of the visit
Device: Condition based on Device capability (it rely on NetBiscuit service charged separately)
GeoIp: Condition based on user geolocation (rely on Sitecore service based on MaxMind, charged separately
Outcomes: Condition based on the engagement plan status and outcomes triggered
Security: Condition based on user security context, eg.  is anonymous etc
Social : Conditions based on Social network information, in the case the user has a federated identity via social network can be used to personalised on the profile information
Visit: Condition based on the current visit (eg. goal / event, campaign, previous interactions, engagement value, search keyword etc)
Visitor: Condition based on previous interactions (require analytics to be enabled)



Tracker is not initialized error

Within Sitecore 8.1 and 8.2 you could get easily this “Tracker is not initialized error” even if you are not planning to use analytics but for laziness you have not disabled analytics and/or you left within your layout the VisitorIdentification tag…

The simpler way to get rid of this issue if you are not using Analytics is to remove  Sitecore.Analytics.Tracking.config from your include folder.

In the case you want to use analytics therefore you should check that in Sitecore.Analytics.Tracking.config your hostname property is set to the DNS name that you are using to access to your website….

Trigger an Outcome Programmatically

As you probably already know, the main difference between an outcome and a goal, is the possibility to assign a monetary value to an outcome so that you can use it to get better reporting within your analytics and eventually to understand which paths/content converted better.

Outcomes can only be assigned programmatically, this snippet simulate a controller rendering that trigger the ProductPurchase Outcome.

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Sitecore.Mvc;
using System.Web.Mvc;
using System.Web;
using Sitecore.Analytics.Outcome.Extensions;
using Sitecore.Analytics.Outcome.Model; 

public ActionResult PurchaseOutcome()
        // Register an outcome
        //It will only be saved to the database on session end

        var id = Sitecore.Data.ID.NewID;
        var interactionId = Sitecore.Data.ID.NewID;
        var contactId = Sitecore.Data.ID.NewID;

       // definition item for Purchase Outcome
      var definitionId = new Sitecore.Data.ID("{9016E456-95CB-42E9-AD58-997D6D77AE83}");

        var outcome = new ContactOutcome(id, definitionId, contactId);
        outcome.MonetaryValue = 153;
        return Content("Outcome purchase 153");

These are the references required:


And this is the Outcome definition:


XDB Contact Rules to personalize based on the facet value

As you are probably familiar, Sitecore 8 architecture is all around XDB and the Contacts.

Arguably Sitecore forgot to ship OOTB personalisation rules based on the Contact facet value of the contacts stored in XDB

Luckily Adam Conn has created two projects

to deliver almost OOTB personalisation based on Contact Facet conditions

Once that you have installed Adaptive rules and Contact Utilities you will be able to personalise based on Contact Facets…. In this example I personalise the content based on the Gender of the Contacts


Personal Facets



Sitecore CMS only mode on 8.1

As you probably now, Sitecore 8.1 can run in CMS only mode that means that your Sitecore instance can live also without MONGODB architecture…

CMS only mode, disable all the features that require MONGODB like Analytics, behaviour personalisation, MVT but it still allow you to run inSession personalisation rules or execute personalisation rules that do not require MongoDB (eg. geoLocation personalisation)

In order to run Sitecore in CMS only mode you need to set the following parameters:

  1. Xdb.Enabled
  2. Xdb.Tracking.Enabled
  3. Xdb.Configuration.XdbSettings

Further documentation on CMS only mode can be found here: