Steps to Enable Sitecore Analytics and Verify Data flow to Shard Databases

Hello everyone, This blog will help us to understand what settings are required to enable Sitecore Analytics in newly installed Sitecore instance. We will also see one common errors which get logged in our logs after setting up of our local instance. We will see the steps required to solve the same.

Without wasting time, let's start with the steps.

Steps to enable Analytics and verify data is flowing to Shard DB or not

1. Changed the below settings to true in the indexersettings.xml file in xconnect webroot

 Path:C:\inetpub\wwwroot\xconnectinstance\App_Data\jobs\continuous\IndexWorker\App_Data\config\sitecore\SearchIndexer

    o IndexPIISensitiveData

    o IndexAnonymousContactData

2. Rebuilt the xconnect indexes using the following command. Refer Rebuild XConnectIndex for same.

Path: C:\inetpub\wwwroot\xconnectinstance\App_Data\jobs\continuous\IndexWorker

    o Sitecore.XConnectSearchIndexer -rr

3. Rebuilt the Sitecore indexes as well

4. Rebuilt all three link database from control panel

5. Rebuilt reporting database by adding a new secondary database. Refer Link

    Path : /sitecore/admin/RebuildReportingDB.aspx

6. Checked Marketing definitions are deployed from Control Panel

7. Added below in the layout file

    o @using Sitecore.Mvc.Analytics.Extensions

    o @Html.Sitecore().VisitorIdentification()

8. Disabled the below bot settings false Marketing.Tracking --> Sitecore Analytics.Tracking

    o <setting name="Analytics.AutoDetectBots" set:value="false" />

    o <setting name="Analytics.Robots.IgnoreRobots" set:value="false" />

9. Below tracking settings are set to true

    o Xdb.Enabled

    o Xdb.Tracking.Enabled

10. Ensured no IPs have been added in the <excludedIPAddresses> tag

11. All three windows services (Marketing Automation, Processing, Index Worker) are on and working

Additional Notes :

1. If you are getting access-to-the-registry-key-global-is-denied issue in your logs then follow below steps: Run the following command in your command prompt. instance name is your local instance name. You can refer below Link for the same.

CMD> net localgroup "Performance Monitor Users" "IIS APPPOOL\instance name" /add

CMD> net localgroup "Performance Log Users" "IIS APPPOOL\instance name" /add

CMD> net localgroup "Performance Monitor Users" "IIS APPPOOL\xconnect instance name" /add

CMD> net localgroup "Performance Log Users" "IIS APPPOOL\xconnect instance name" /add

2. Data is still not flowing to Shard then you might be missing the post installation steps which need to be executed in SSMS. Database prefix will be your local database prefix name. Try to run this query in SQL Command mode.

       
:SETVAR DatabasePrefix Sitecore10XP1
:SETVAR UserName collectionuser
:SETVAR Password Test12345
:SETVAR ShardMapManagerDatabaseNameSuffix _Xdb.Collection.ShardMapManager
:SETVAR Shard0DatabaseNameSuffix _Xdb.Collection.Shard0 
:SETVAR Shard1DatabaseNameSuffix _Xdb.Collection.Shard1

GO

IF(SUSER_ID('$(UserName)') IS NULL) 
BEGIN  
       CREATE LOGIN [$(UserName)] WITH PASSWORD = '$(Password)'; END; 
GO 
 
USE [$(DatabasePrefix)$(ShardMapManagerDatabaseNameSuffix)]  
IF NOT EXISTS (SELECT * FROM sys.database_principals WHERE name = N'$(UserName)') BEGIN 
    CREATE USER [$(UserName)] FOR LOGIN [$(UserName)]   
       GRANT SELECT ON SCHEMA :: __ShardManagement TO [$(UserName)]        GRANT EXECUTE ON SCHEMA :: __ShardManagement TO [$(UserName)] END; 
GO 
 
USE [$(DatabasePrefix)$(Shard0DatabaseNameSuffix)]  
 
IF NOT EXISTS (SELECT * FROM sys.database_principals WHERE name = N'$(UserName)') BEGIN 
    CREATE USER [$(UserName)] FOR LOGIN [$(UserName)]   
       EXEC [xdb_collection].[GrantLeastPrivilege] @UserName = '$(UserName)' END; 
GO 
 
USE [$(DatabasePrefix)$(Shard1DatabaseNameSuffix)]  
 
IF NOT EXISTS (SELECT * FROM sys.database_principals WHERE name = N'$(UserName)') BEGIN 
    CREATE USER [$(UserName)] FOR LOGIN [$(UserName)]  atabs
       EXEC [xdb_collection].[GrantLeastPrivilege] @UserName = '$(UserName)' END; 
 
GO 
	   
 

Once all steps are completed, you should be able to see analytics is working fine and data is flowing to respective Shard Databases.

Thanks for reading and happy learning

You can checkout my other blogs too. Link

Comments

Popular posts from this blog

Sitecore XM Cloud Form Integration with Azure Function as Webhook

Automate RSS Feed to Sitecore XM Cloud: Logic App, Next.js API & Authoring API Integration

Create and Fetch Content From Sitecore Content Hub One using GraphQL and React