Unleash the Potential of Power Platform With a Center of Excellence
Business innovation often comes from within. Discover how to empower innovation from non-traditional developers with the Microsoft Power Platform.
With the latest versions of Sitecore, MongoDB has become a requirement for the analytical experience. Different versions of MongoDb are only compatible with certain versions of Sitecore. I’ve found this information from Sitecore that outlines the versions of MongoDb that are compatible with the versions of Sitecore. Below is the compatibility chart presented in the previous link.
For this post I’m working with Sitecore 8 update 4 and the information provided will be relevant to the 2.6.x versions of MongoDb, but ‘may’ still be relevant in newer versions.
Download the latest 2.6.x version of MongoDb from www.mongodb.org. Select ‘Previous Releases’ then 2.6.12 from the top drop down. I’m using the community version for this post, so the Enterprise versions may have additional install options that are not outlined here.
Once the installer has been downloaded, run it to start the MongoDb installation process.
Accept the License Agreement and press the ‘Next’ button
Select ‘Typical’ for the setup type and press the ‘Next’ button.
Press the ‘Install’ button
MongoDb is now installed. Now it’s time to configure it and setup it up to run as a Windows Service.
Create directories to store the db and log files. For my instance I created a MongoData folder on my C:\ then added the db and log directories underneath that.
In the C:\MongoData directory I created the MongoDb configuration file named ‘mongod.cfg’. The contents of the configuration file are shown below.
*note that the contents are the configuration file are in YAML format, so do not use TABs before the properties. Spaces can be used to designate the fields underneath the systemLog and storage items.
To run MongoDb as a Windows Service open an elevated command prompt window and use the following command (adjust your paths as necessary):
“C:\Program Files\MongoDB 2.6 Standard Legacy\bin\mongod.exe” –config “C:\MongoData\mongod.cfg” –install
*note that if you copy and paste you may need to adjust the quotes, and there should be 2 dashes before the ‘config’ and ‘install’ options.
Once the command has been run, start the MongoDb service using the command ‘net start MongoDb’.
Now that MongoDb is installed and running as a Windows Service, Sitecore needs to know how to connect to it. This is achieved through modifications to the ConnectionStrings.config file located in the website’s /App_Config directory. Entries for ‘analytics’, ‘tracking.live’, ‘tracking.history’, and ‘tracking.contact’ will be updated as follows (replace test.local with your instance information).
port 27017 is the default port used by MongoDb
Also, verify that the ‘Analytics.Enabled’ setting is set to true in the /App_Config/Include/Sitecore.Analytics.config patch file.
Browse a few pages of the site as MongoDb does not start populating data until visits occur. You can view the contents of the collections using the MongoVue ( http://www.mongovue.com ) or the RoboMongo (https://robomongo.org/ ) tools. By default data isn’t written to mongo until the visitor session ends. The out-of-the-box timeout period for the session is 20 minutes. This can be updated via a web.config transform using the following in the <system.web> node:
In the image below interactions are visible in MongoVue.
Once MongoDb is connected and receiving data, check in your Sitecore instance to see if the Analytics data is being received in the Dashboard and Experience Analytics screens.
If the graphs don’t display, there are additional steps needed to finish setting up the instance.
The process for correcting this issue is outlined in the Sitecore Knowledgebase article:
Basically, a secondary reporting database will need to be created. For my instance I copied the Sitecore_Analytic db from the Sitecore Install zip package to my database directory. Before attaching I renamed the .mdf and .ldf files to Sitecore.Analytics.Secondary.
Attach the database in your SQL Server and setup the secondary connection string in your /App_Config/ConnectionStrings.config. Replace the database with your analytics and analytics secondary database names.
Once the db is setup and defined in the connection strings, navigate to the RebuildReportingDB.aspx page located under /Sitecore/admin
Press the start button to begin rebuilding.
Once the rebuild is complete, switch the reporting connection strings so that ‘reporting’ now points to the secondary database. Replace the database name with your analytics secondary database name.
After switching the connection strings for the reporting database you’ll want to redeploy the marketing data. Navigate to RedeployMarketingData.aspx located under /Sitecore/admin.
Redeploy the segments and maps.
In my local test environment it took over 30 minutes for the information collected by the visits to be aggregated and displayed in the graphs on the Dashboard, Experience Analytics, and Experience Profile screens.
Check back for a post that goes over configuring and working with GEO IP.