I am trying to setup DMS on Sitecore 7.2 using MVC. I am able to set personalization rules via the Page Editor but the rules do not run when I view the page as a normal users. I have checked the following:
- Analytics.Enabled is set to true
- @Html.Sitecore().VisitorIdentification() has been added to the main layout
- The analytics DB is setup
- No errors are showing in the logs.
- I have enabled the config file Sitecore.MvcAnalytics.config
- analytics is enabled for the site.
- My conditions work in WebForms, it is only MVC that doesn't work.
We have narrowed the problem down to Controller Renderings, our solution works for View Renderings. Has anyone made personalisation work with Controller Renderings? We have replicated this problem in a vanilla SC instance.
Here is a video of our problem:
http://screencast.com/t/1nGwUINJLZO
This is a screenshot of my controller code:
And the components on the page:
We have tried to setup a test with the minimum amount of interference.
Problem
The problem was caused by the Sitecore.Forms.Mvc.config file. I hadn't mentioned WFFM in my original question because I assumed that it wouldn't affect DMS.
When you enable DMS without WFFM the getRenderer pipeline looks like this:
You can see here that the first entry is a processor that analytics inserts to control personalisation. If we now enable the Sitecore.Forms.Mvc.config this pipeline changes to this:
Notice that the WFFM Forms MVC entry inserts itself at the start of the pipeline. This causes problems because it returns a rendering:
The CustomiseRendering processor then does nothing because there is a returned result, therefore no personalization is performed:
Cause:
This is caused by the order that the MVC, Web Forms and Analytics configs are loaded. By default they are loaded in this order:
This is the correct order.
Solution:
The solution is to rename the Sitecore.Forms.Mvc.Config to y.Sitecore.Forms.Mvc.config to force it to be loaded last.