13

Is it possible to exclude some Sitecore Items from analytics tracking? We have a few items under sitecore/Content/Sites/MySite/Third Party/ that are consumed by our support site (which does not reside in Sitecore). I want to exclude any items in the /Third Party/ folder from being tracked in Sitecore Analytics.

I am running Sitecore 8.1 Update 2 and xDB Cloud

0

4 Answers 4

19

I actually just discovered the answer to my own question after more poking around.

  • Highlight the item in the Sitecore Content Explorer.
  • From the Analyze ribbon select the Attributes button.
  • In the Attributes dialog box that appears click the Settings tab.
  • There is a "Disable analytics for this page" checkbox on this tab. Check it.
3
  • 2
    Looks better than my approach, no code required. Just to add extra info, this value is saved to a field named: __Tracking (ID: b0a67b2a-8b07-4e0b-8809-69f751709806). Value after checking checkbox is <tracking ignore="1" />. Might be useful if you want update multiple items with script. Commented Oct 6, 2016 at 23:47
  • but, i'm not sure if it will disable the analytics tracking for all the child pages also under that item. Commented Oct 7, 2016 at 2:37
  • That is why I shared with you what is the raw value of the field to use for example PowerShell Extensions to change all items recursively. Commented Oct 7, 2016 at 5:39
3

Even though you disabled the "disable analytics tracking for this page" setting for the sitecore/Content/Sites/MySite/Third Party/ item, I don't think it will stop analytics tracking for the child item under that root item.

If your support site items are based on different data template (which is not used in other areas of your sitecore content tree), then you can set this setting in __Standard Values item of that template, which should make it effect all the items created using that template.

1
  • 1
    There were only eight items in that folder -- and they used a template shared with the rest of the site -- so I just set this on each one. But your tip on the __Standard Values is good to keep in mind. Commented Oct 7, 2016 at 2:51
2

If for some reason you need to do it via code, I would go with this:

Open Sitecore.Analytics.Tracking.config and find following node

  <startAnalytics>
    <processor type="Sitecore.Analytics.Pipelines.StartAnalytics.CheckPreconditions, Sitecore.Analytics" />
    <processor type="Sitecore.Analytics.Pipelines.StartAnalytics.CreateTracker, Sitecore.Analytics" />
    <processor type="Sitecore.Analytics.Pipelines.StartAnalytics.StartTracking, Sitecore.Analytics" />
  </startAnalytics>

Add additional processor after CheckPreconditions or try to overwrite StartTracking processor.

There is following code inside:

  Tracker.Current.StartTracking();

Try to wrap this fragment with your custom conditions.

EDIT:

Inside that method there is a fragment for checking condition from an item (<tracking ignore="1" /)

private static bool IgnoreCurrentItem()
{
  Item obj = Sitecore.Context.Item;
  if (obj != null)
  {
    TrackingField trackingField = TrackingField.FindTrackingField(obj);
    if (trackingField != null)
      return trackingField.Ignore;
  }
  return false;
}
0

In case if you want to fully disable analytics tracking, there are few differences in 8.1 compared to earlier versions

Update: you need to set Xdb.Tracking.Enabled to false in latest versions (from 8.1) to stop tracking analytics data

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.