How to disable Sitecore Analytics entirely

2019-03-28 12:33发布

问题:

We are experiencing cpu problems on our production servers. After profiling with the jetbrains cpu profiler, we have noticed that some functions in the assembly Sitecore.Analytics were executed.

This is somewhat strange because we have disabled all analytics related configuration in de config files.

After looking into the /sitecore/admin/showconfig.aspx we noticed that there are still a lot of Sitecore.Analytics related configurations in this config while these are deactivated in our config files.

For example

In the file /App_Config/Include/EventHandlers.config the configuration looks like this:

<configuration xmlns:patch="http://www.sitecore.net/xmlconfig/">
 <sitecore>
   <events timingLevel="custom">
   </events>
 </sitecore>
</configuration>

When looking into the showconfig.aspx it looks something like this:

<events timingLevel="custom">
<event name="forms:save"/>
<event name="item:saved">
            <handler type="Sitecore.Analytics.Data.Items.ItemEventHandler, Sitecore.Analytics" method="OnItemSaved"/>
            <handler type="Sitecore.Analytics.Automation.Data.Items.ItemEventHandler, Sitecore.Automation.MarketingAutomation" method="OnAutomationStateChanged"/>
        </event>
        <event name="item:deleted">
            <handler type="Sitecore.Analytics.Automation.Data.Items.ItemEventHandler, Sitecore.Automation.MarketingAutomation" method="OnAutomationStateChanged"/>
        </event>
        <event name="media:request">
            <handler type="Sitecore.Analytics.Media.MediaRequestEventHandler, Sitecore.Analytics" method="OnMediaRequest"/>
        </event>
</events>

Does anyone has an idea why these are still returning in the showconfig.aspx? Is there a way to fully delete/disable the sitecore analytics module?

回答1:

Yes. Rename the 3 configuration files for Sitecore.Analytics in your /App_Config/Include directory to something other than *.config

The 3 files are:

  • Sitecore.Analytics.config
  • Sitecore.Analytics.ExcludeRobots.config
  • Sitecore.Analytics.RobotDetection.config

(could vary a little bit by version, but they all start with Sitecore.Analytics).

Rename them to something like:

  • Sitecore.Analytics.config.disabled
  • Sitecore.Analytics.ExcludeRobots.config.disabled
  • Sitecore.Analytics.RobotDetection.config.disabled


回答2:

(could vary a little bit by version, but they all start with Sitecore.Analytics).

Until sitecore version 72, there are only 3 files with Sitecore.Analytics prefix. In version 75, there are 17 and in version 8 there are 20 config files with Sitecore.Analytics prefix.

I used to confirm with sitecore support that you can change the setting of Analytics.Enabled in Sitecore.Analytics.config will disable Analytics

<setting name="Analytics.Enabled" value="false" />

Or only rename one file Sitecore.Analytics.config which contain this setting.



回答3:

Did you try to User WFFM ? There also analytics part: Sitecore.WFFM.Analytics.config

and disabling it causes this fault:

22992 14:49:10 WARN Value cannot be null. Parameter name: owner Exception: System.ArgumentNullException Message: Value cannot be null. Parameter name: owner Source: Sitecore.Kernel at Sitecore.Diagnostics.Assert.ArgumentNotNull(Object argument, String argumentName) at Sitecore.Diagnostics.Log.Warn(String message, Object owner) at Sitecore.WFFM.Core.Extensions.Warn.IsNull(Object obj, String name) at Sitecore.WFFM.Analytics.AnalyticsTracker.get_SessionId() at Sitecore.Form.Core.FormDataHandler.ExecuteSaveActions(ID formId, ControlResult[] fields, ActionDefinition[] actions) at Sitecore.Form.Core.FormDataHandler.ProcessData(SimpleForm form, ControlResult[] fields, ActionDefinition[] actions)

So it cannot be disabled.