Activate Reporting Service on Content Delivery Environments

Activate Reporting Service on Content Delivery Environments

I was recently working on a Sitecore upgrade from 8.2.7 to 9.3. As a part of the upgrade process, we had to upgrade to a newer version of the Sitecore WeBlog module. The WeBlog team has done a pretty good job of keeping up with current versions, so this process was pretty simple. However, as we were completing the upgrade we noticed one of the components had stopped working. The "Interesting Entries" component was not rendering any data on the page; even worse, it was logging an error when it tried to load. 

After doing some poking around on the internet, I came across this issue: The Interesting Entries component leverages the reporting database to pull page view counts for each article. Unfortunately, an OOTB scaled Sitecore solution does not give a Content Delivery server access to the Remote Reporting Server or the reporting database. Per the details in the issue, there are two ways to resolve this issue:

  1. Remove the component from the page
  2. Add a connection to the reporting service for the CD

It looks like most people have gone the route of just removing the component from the page, but we did not want to do that. Unfortunately, the link in the issue on how to do the configuration is a dead link. There is not a ton of documentation out there on how to configure the reporting service for 9.3. I assume this is because it comes configured on your Content Management server by default when using a scaled topology. The default configuration on the CM server can be used to configure the CD, with some small tweaks.

The below config file will configure your CD server to connect to the reporting service:

<configuration xmlns:patch="" xmlns:role="">
  <sitecore role:require="ContentManagement or ContentDelivery">
    <reporting role:require="!Reporting">
      <dataProvider type="Sitecore.Xdb.Reporting.ReportDataProvider, Sitecore.Xdb.Reporting" singleInstance="true" cacheEnabled="false">
        <datasources hint="list:RegisterDataSource">
          <add key="item" type="Sitecore.Xdb.Reporting.Datasources.ItemReportDataSource" />
      <remote enabled="true">
        <httpTransportFactory type="Sitecore.Analytics.Core.ApiKeyHttpTransportFactory, Sitecore.Analytics.Core" singleInstance="true">
          <param desc="serviceUrl">{{Reporting Service URL Goes Here}}</param>
          <param desc="requireHttps" type="System.Boolean" factoryMethod="Parse" arg0="true" />
          <param desc="connectionStringName">reporting.apikey</param>
          <!-- The same header name must be defined in Sitecore.Xdb.Remote.Server.config for reporting.-->
          <param desc="headerName">X-Reporting-Api-Key</param>
          <param desc="minimalApiKeyLength">32</param>
          <param desc="timeout">100000</param>
        <proxyDataSource type="Sitecore.Xdb.Reporting.Datasources.Remote.RemoteReportDataSourceProxy, Sitecore.Xdb.Reporting" />

The first portion of the file is what fixes the error that is logged: Could not find configuration node: reporting/dataProvider. The second portion of the file enables remote reporting.

You will need to provide the url to your remote reporting service for the CD to connect. If you do not know this URL, you can likely find it in the showconfig of your CM server. The last thing you need to do is add the reporting API key to the connection strings file for your CD. Once again, you can likely find this by examining your CM configuration.

One config file and one connection string, and your CD can talk to the reporting service. In our case, this allowed us to continue using the Interesting Entries component from the WeBlog module. You might find other reasons to put your analytics data on your page.

Happy Sitecore'ing!