2

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

2

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)
{
    Session.Abandon();
}
</script>
<!DOCTYPE html>
<html>
<body>
<form runat="server" id="form">
    Session Abandoned
</form>
</body>
</html>

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.

i.e.

88a7b5ce440743fa840ef5ac0aab05e9

becomes

88A7B5CE-4407-43FA-840E-F5AC0AAB05E9

`

This guid is your device profile ID.

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

SELECT *
  FROM [Sitecore_Xdb.Collection.Shard0].[xdb_collection].[DeviceProfiles]
  WHERE DeviceProfileId = 'device-profile-id'
  UNION
SELECT *
  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:

SELECT *
  FROM [Sitecore_Xdb.Collection.Shard0].[xdb_collection].[Interactions]
  WHERE ContactId = 'your-contact-id'
  UNION
SELECT *
  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 you have read our privacy policy.

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