We have OneTrust Cookie banner on the site and if the user does not give permission to track Performance Cookies we have a pipeline that turns on/off Sitecore Tracker.

We are not deleting the SC_ANALYTICS_GLOBAL_COOKIE just turning the tracker on/off based on User Preference.

What is the best way to test this in Sitecore. What I want to test is: If the user turns off Tracking then the user session is not tracked anymore. Is there a parameter in the Sitecore Analytic dashboard that shows session data for all users? Is there is unique session Id created for each session?

Note: We do not have a login on the site

1 Answer 1


One approach to confirm the session data is not being tracked would be to check that the data is not being stored in XConnect database.

First of all confirm data is being stored correctly. A users data is sent to XConnect when their session ends. You could either navigate pages and wait the specified time for session to expire, or you can force the session to be abandoned.

To force the session to be abandoned, create a file called abandon.aspx and copy the contents of the below into it.

<%@ Page Language="C#" AutoEventWireup="true" %>
<script runat="server">
protected void Page_Load(object sender, EventArgs e)
<!DOCTYPE html>
<form runat="server" id="form">
    Session Abandoned

Place abandon.aspx at the root of your sitecore instance.

Now to simulate a visit. Navigate to your site, browse across a number of pages, then finally navigate to https://yoursite.com/abandon.aspx

This should then force the session to end and save data to XConnect.

To confirm the data has been stored, find the value of your SC_ANALYTICS_GLOBAL_COOKIE and the necessary dashes to make it into a valid guid, and then convert to UPPER case.






This guid is your device profile ID.

Now go to your SQL database that houses XConnect Shard tables and perform this query:

  FROM [Sitecore_Xdb.Collection.Shard0].[xdb_collection].[DeviceProfiles]
  WHERE DeviceProfileId = 'device-profile-id'
  FROM [Sitecore_Xdb.Collection.Shard1].[xdb_collection].[DeviceProfiles]
  WHERE DeviceProfileId = 'device-profile-id'

Note the value of 'LastKnownContactId'.

This is your Contact Id.

Now see the data from your last site visit, perform the following query:

  FROM [Sitecore_Xdb.Collection.Shard0].[xdb_collection].[Interactions]
  WHERE ContactId = 'your-contact-id'
  FROM [Sitecore_Xdb.Collection.Shard1].[xdb_collection].[Interactions]
  WHERE ContactId = 'your-contact-id'

If your Xconnect is setup correctly (and your performed the above actions against a CD or standalone server role). Then you should see the data from your last interaction.

Finally, to confirm that a users data is not being stored. Peform the above actions and confirm that ONLY a user who has requested not to be tracked, does not have there data stored as above.

Your Answer

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

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