SharePoint 2016 - Popularity Trends And Usage Data Return No Results

Issue - Popularity trends or usage data is not working in any SharePoint 2016 environment.

All the search related reports are showing the data but no Analytics related data is getting displayed in the report. We are getting 0s in every report.

We learned that SharePoint 2013 Analytics is now the part of Search Service Application. The process of how analytics works -

  • Search Service Application configure and connect to the web application
  • Usage and Health data collection service application configured on both farms (Search farm and content farm)
  • Search complete the crawl successfully
  • Users perform actions on their sites
  • Now "Microsoft SharePoint Foundation Usage Data Import" will dump the data in Analytics logs on the local farm as well as update the EventStore at search farm.
  • Usage Analytics process @1am and dump the data in Analytic DB.

Troubleshooting

  • We checked following things
  • We have connected to search service farm and Search Service application is connected to the web application
  • Search is actively crawling the content.
  • Make "Microsoft SharePoint Foundation Usage Data Import" timers jobs running on schedule
  • The daily job is on Schedule.
  • Check the Usage Log file if the entries are there. On content farm yes it but on search farm, we are not seeing the entries from the content farm.
  • Check the ULS logs but no clue as we are not familiar with usage related entries
  • Open a ticket with MSFT.
  • Enable the VerboseEx Logging and examine the logs. We found this
  • In the ULS, we have seen the referral URL in the ULS logs
  • But following missing Instantiating usage receiver

    • 'Microsoft.Office.Server.Search.Analytics.Internal.AnalyticsCustomRequestUsageReceiver.'
    • Microsoft.Office.Server.Search.Analytics.Internal.ViewRequestUsageReceiver'.

  • Next, we ran the following PowerShell to get the information about the event receiver.
    1. $aud = Get-SPUsageDefinition | where {$_.Name -like "Analytics*"}  
    2. $aud | fl  
    SharePoint

    and now, run this command.
    1. $prud = Get-SPUsageDefinition | where {$_.Name -like "Page Requests"}  
    2. $prud | fl  
    SharePoint
  • The output is clearly showing us that both the Event Receivers are disabled.
  • Here is our breakpoint.

Root Cause

As we have seen in the ULS logs that Event Receivers for both the usage definitions are disabled. I think this is because we do not have the Search service application in the content farm so SharePoint does not enable these event receivers as these required search service application.

Resolution

We have to enable both the Event Receivers and attach it to Usage Service application in the Content Farm. Please follow these steps.

Enabling the Event Receivers

Let's enable the event receivers, We have to run the command in the Content Farm.

Page Requests

Run the below PowerShell in Content farm: for enabling the event receivers,

  1. $prud = Get - SPUsageDefinition | where {  
  2.     $_.Name - like "Page Requests"  
  3. }  
  4. $prud.EnableReceivers = $true  
  5. $prud.Enabled = $true  
  6. $prud.Update()  
  7. $aud = Get - SPUsageDefinition | where {  
  8.     $_.Name - like "Page Requests*"  
  9. }  
  10. $aud | fl  
SharePoint

For Analytics

  • Run the below PowerShell in Content farm: for enabling the event receivers,
    1. $aud = Get - SPUsageDefinition | where {  
    2.     $_.Name - like "Analytics*"  
    3. }  
    4. $aud.EnableReceivers = $true  
    5. $aud.Enabled = $true  
    6. $aud.Update()  
    7. $prud = Get - SPUsageDefinition | where {  
    8.     $_.Name - like "Analytics"  
    9. }  
    10. $prud | fl  
    SharePoint

Attaching Event Receivers

Page Requests

  • Run the below PowerShell in Content farm to attach the page request receiver,
    1. $prud = Get-SPUsageDefinition | where {$_.Name -like "Page Requests"}  
    2.   
    3. $prud.Receivers.Add("Microsoft.Office.Server.Search.Applications, Version=16.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c","Microsoft.Office.Server.Search.Analytics.Internal.ViewRequestUsageReceiver")  
    4.   
    5. $prud.EnableReceivers=$true  
    SharePoint

For Analytics,

  • Run the below PowerShell in Content farm to attach the Analytics receiver.
    1. $aud = Get-SPUsageDefinition | where {$_.Name -like "Analytics*"}  
    2.   
    3. $aud.Receivers.Add("Microsoft.Office.Server.Search.Applications, Version=16.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c""Microsoft.Office.Server.Search.Analytics.Internal.AnalyticsCustomRequestUsageReceiver")  
    4.   
    5. $aud.EnableReceivers = $true  
    SharePoint

Now, let us wait for 24 hours and everything will be working as expected.