Sitecore Personalisation – Getting it working
I’ve been browsing around Sitecore forums and resources and there are often devs posting about Personalization not working working for their site or how to customise their site in a given scenario.
The thing is the former is fairly straight forward with a little guidance and the latter can be achieved with some knowledge and examples. Therefore I thought I’d help the community out by posting a short series of Quick Start Guides on everything from getting Personalization working to dynamically changing content and altering the site based on conditions.
I’ll start with everything that you need to do to get Personalization working in your site.
1. Analytics Database
The most fundamental thing you will need to confirm is that you have the Sitecore Analytics database installed. If you have used the Sitecore Installer to create your instance the database will be in MSSQL if you are running Sitecore 7.2 or less and in MongoDB if you’re running Sitecore 7.5 or above.
If the database is not present you will likely need to download install Sitecore DMS from the Sitecore Developer Network for your version of Sitecore.
2. Connection strings
After you have confirmed your Analytics database is present you will want to check a connection strings has been defined for it and has the correct username and password to access it.
The most effective way to confirm the username and password grants access to the database is to use those credentials to login and confirm you can read data from the database’s tables. If this doesn’t work you will need to grant the account to have access to the database or use a different account that can.
The connection string will be defined in the ConnectionStrings.confilg file in the App_Config folder folder of your webroot.
In Sitecore 7.2 or less the connection string will be a SQL connection string see below
<add name="analytics" connectionString="user id=jRobbins;password=SafePassword;Data Source=ServerAddress;Database=Sitecore.Analytics"/>
For Sitecore 7.5 and above the connection will be a MongoDB connection string, like below
<add name="analytics" connectionString="mongodb://ServerAddress/analytics"/>
An additional check for Sitecore 7.5 and above is that the Sitecore.Analytics.config file has a reference to this connection string.
<dataAdapterManager defaultProvider="mongo"> <providers> <clear/> <add name="mongo" type="Sitecore.Analytics.Data.DataAccess.MongoDb.MongoDbDataAdapterProvider, Sitecore.Analytics.MongoDb" connectionStringName="analytics"/> </providers> </dataAdapterManager>
3. Enabling analytics
Now that you have confirmed analytics is installed and correctly set up its time to turn it on.
In the App_config/Includes folder your webroot you will need to find the file Sitecore.Analytics.config. If you can’t find it it may be missing from the environment or DMS has not been installed, see above.
In this file you will need to confirm that the Analytics is enabled and is allowing reads and writes to the database. The required settings are shown below
<!-- ANALYTICS DISABLE DATABASE Disables the database so that no reading or writing to the database occurs. Default: false --> <setting name="Analytics.DisableDatabase" value="false" /> ... <!-- ANALYTICS ENABLED Determines whether analytics is enabled or not. Default: true --> <setting name="Analytics.Enabled" value="true" />
Finally you will want to enable Analytics for the sites you wish to have personalization on. This is achieved via the enableAnalytics property of a site in the node of the web.config.
<site name="website" virtualFolder="/" physicalFolder="/" rootPath="/sitecore/content" startItem="/home" database="web" domain="extranet" enableAnalytics="true" enablePreview="true" enableWebEdit="true" enableDebugger="true" disableClientData="false" />
4. Enabling Personalisation options
Finally you now need to set Sitecore so that it displays the options to personalize your site.
To do this log into the Content Editor of your site and click the Sitecore logo, or the Menu Icon in Sitecore 8, to access the Instance properties. Then you will want to click ‘Application Options’.
In the Application Options model select the View tab and check the ‘Show the Personalization section’ checkbox and press okay.
Now you will be able to see the Personalization button in the Presentation Details modal via the Content Editor.
In the Page Editor, or Experience Editor if you are using Sitecore 8, you’ll see the Personalization button in the Command pop-up.
And that’s it!
You are now up and running to create a personalized experience for your users!
The next post in the series will cover how to dynamically change your site’s content to better suit individuals and scenarios.