How to confirm data is flowing into xconnect

xconnect

After setting up a new sitecore XP instance or upgrading a new one, you might find yourself wanting to confirm everything is setup correctly.

To do this, first access your new instance either on the CD or Standalone role. Then browse a number of pages. A users data is sent to XConnect when their session ends. You could either 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. Then place the file inat the root of your sitecore instance.

<%@ 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>

No if you navigate to your site, and navigate to https://yoursite.com/abandon.aspx it will force the session to end and hopefully send the data to XConnect.

Confirming connectivity

The first thing you might want to confirm is that there are no exceptions in your logs. A typical one you might find is XConnectUnavailableException. This often means some error in the confiuration, certificates or network access to you xconnect role from the sitecore instace.

Another thing you could check is that there is an entry in the IIS logs for the xconnect application. You can find these at C:\inetpub\logs\LogFiles and then the numbered directory relating to your application (found via advanced properties on IIS).

Confirming data is in the database

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.

Look at the specific events you triggered

If you review the most recent record that is returned from the query above. Then copy the value stored in Events column and format the json. You will see something like that which is shown at the bottom of the page. This shows a variety of pageview events, goals triggered and a ChangeProfileScoresEvent which were all triggered in the recent session.

Summary

I hope these few little pointers will help you to confirm that data is flowing into your xconnect instance. If not, then they should atleast help you start to troubleshoot where the problem might lie.

Leave a Reply

Your email address will not be published. Required fields are marked *