Sitecore DMS setup steps & test code

Sitecore DMS setup tips. One of the major strengths of Sitecore CMS compared to other enterprise CMS solutions is the ability to easily personalise content using DMS (Digital Marketing System).

A common scenario involves setting up DMS for the first time, so that as a developer you can get confidence in using Sitecore DMS, and more importantly to show your marketing team how it works in practise.

Here are a few basic steps:

  1. Setup a new profile in the content editor and work out the basic settings.
  2. Create the profile keys that are used to measure visitor behaviour
  3. Create Pattern Cards, that identify a visitor type based on profile key values
  4. Create profile cards, that can be used to easily tag pages with set profile key scores.

The following diagram shows a Sitecore DMS Profile setup:


Once the above basics have been setup you can start tagging pages in sitecore to have

To test DMS you must use the Sitecore Experience explorer on the Sitecore marketplace, this is a must. see Sitecore Experience explorer here.

Having setup the DMS, tagged the pages and tested the site using the Experience Explorere the personalisation should work. If it does not then you probably need to output the Profile Key Scores and Pattern matches in a real (not logged in) test.

The below  code can be added to a user control to output these values (Sitecore Profile Key Values and Pattern Matches) for the current user in the pages meta.


Compatible with Sitecore 7.0, Sitecore 7.1 and Sitecore 7.2

The code  to output this meta:

protected void Page_Load(object sender, EventArgs e)
            if (Tracker.Visitor.CurrentVisit == null || 
                Tracker.Visitor.CurrentVisit.Profiles.FirstOrDefault() == null)
                AddFieldToPage("Profile_CurrentVisitor", "NOT EXIST");

            var visitProfileInstance = Tracker.Visitor.CurrentVisit.Profiles.FirstOrDefault();

            foreach (var profileItem in Tracker.DefinitionItems.Profiles)
                // output the users individual scores for each ProductKey 
                foreach (var pKey in profileItem.Keys)
                    var value = (visitProfileInstance == null) ? 0.0 
                               : visitProfileInstance.GetValue(pKey.KeyName);
                    var key = string.Format("Profile={0},ProductKey={1}", 
                                   profileItem.Name, pKey.KeyName);
                    AddFieldToPage(key, value);

                // output users matching PatternCard
                foreach (var pattern in profileItem.Patterns)
                    if (Sitecore.Data.ID.Parse(visitProfileInstance.PatternId) == pattern.ID)
                        var key = string.Format("PATTERN_MATCH_for_Profile={0}", profileItem.Name);
                        var value = pattern.Name;
                        AddFieldToPage(key, value);

        private void AddFieldToPage(object key, object value)
            var meta = new HtmlMeta();
            meta.Name = Convert.ToString(key);
            meta.Content = Convert.ToString(value);

            HtmlHead head = (HtmlHead)this.Page.Header;

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>