Enable Indexing for Anonymous Contacts on Azure PaaS (Sitecore 9 update 1 with xConnect)
Recently deployed a fresh application built using latest Sitecore version (Sitecore 9 Update 1) on Azure PAAS. Client expectation was to use all the personalization features of Sitecore xDB. But turned out that anonymous indexing of contacts is by turned off by default in Sitecore 9 and there were no records showing up in Experience Analytics & Experience Profile Screens.
Here are the steps i followed to resolve the same:
- Ensure all the layout's have VisitorIdentification code:
@using Sitecore.Mvc.Analytics.Extensions @Html.Sitecore().VisitorIdentification()
Once the above code is added, you can see a JS call from the developer tools - when the website is viewed in live mode
2. Make sure the xDB tracking is enabled in Sitecore website or App Service in present scenario
<setting name="Xdb.Tracking.Enabled" value="true" />
3. To enable indexing of anonymous contacts, turn on the setting (IndexAnonymousContactData to true) in below files (Note: this change is required xConnect App service)
{xConnectPath}\App_data\jobs\continuous\IndexWorker\App_data\Config\Sitecore\SearchIndexer\sc.Xdb.Collection.IndexerSettings.xml
{xConnectPath}\App_data\config\sitecore\SearchIndexer\sc.Xdb.Collection.IndexerSettings.xml
<IndexAnonymousContactData>true</IndexAnonymousContactData>
4. Next step is to rebuild the xDB search index
- Stop the indexer web job (Note: Indexer can be found in xConnect App Service -> Web Jobs. "IndexWorker" in below screenshot)
- Drop the index (Note: Navigate to Search service and delete the "xdb" index)
- Restart the indexer
In case of onPremise installation, both these jobs will run as windows service's and execute the below command on xConnect Job path ({xConnectPath}\App_data\jobs\continuous\IndexWorker\XConnectSearchIndexer.exe)
XConnectSearchIndexer -requestrebuild
OR
XConnectSearchIndexer -rr
5. Finally we can see the visits are getting tracked and show up in Experience Profile and other Sitecore Analytics Screens