In the recent releases, Sitecore has moved from a Monolith software approach to a Micro service based one. We have already seen this in other modules like Sitecore Javascript Services(JSS) and Sitecore Cortex. The Sitecore Universal Tracker is a headless API Micro service to track data from mobile apps, IoT, AR, VR and other emerging channels into Sitecore xDB.
Universal Tracker is a collection of services that allow capturing of data across multiple channels, as and when the interactions happen
You might ask yourself, isn’t that xConnect? No, its not. xConnect only accepts immutable history and is designed for trusted service communication – Authentication only, no authorization. Universal Tracker is required to not expose xConnect. Hence, the universal tracker allow capturing of data from multiple channels like Sitecore Websites, Non – Sitecore Websites, Mobile Devices, IoT devices etc. The key difference between xConnect and Universal Tracker is that whereas xConnect collects information regarding completed interactions, Universal Tracker collects information as soon as the interactions occur and submits those to xConnect, when complete.
There are 3 major components of Sitecore Universal Tracker:
There are 3 Pipelines that can be used to manipulate the interactions data.
OOTB all these pipelines are empty.
The Universal Tracker is built to scale. All the components along with the Universal Tracker itself can be scaled to suit the needs of any environment. There can be multiple collection services, in case there are numerous channels. The processing service can be scaled if the data being captured is large, compared to the data being sent to xConnect.
Scaling Collection Service
A scenario that has numerous interactions but low processing:
Scaling Processing Service
A scenario where the number of interactions is less, but the data is processed heavily before being sent to xConnect.
Scaling Universal Tracker
Total scaling to have multiple instances of Universal tracker.
After setting up the Sitecore Universal Tracker by following the guide, there should be two new services; one for Processing and one for Collection along with a new database in SQL server.
Processing Service
The status page of the processing service displays connections for both the SQL Server and xConnect Client as the processing server interacts with both services.
Collection Service
The Collection status page only displays the connection to the SQL server, as it does not directly communicate with the xConnect client.
Before starting, we need to check a few things.
In the Universal Tracker, only Web, Offline and Mobile channels are registered. If you use any other channel, it needs to be registered with Universal Tracker in the following configuration.
\Sitecore.Tracking.Processing.Service\sitecore\Sitecore.Tracking.Processing.ChannelManagement\PipelinesConfig\channelTypes.json
If you want to index anonymous contacts visiting the website, we need to enable IndexAnonymousContactData setting in the following configs:
xconnectpath\root\App_data\jobs\continuous\IndexWorker\App_data\Config\Sitecore\SearchIndexer\sc.Xdb.Collection.IndexerSettings.xml
xconnectpath\root\App_data\Config\Sitecore\SearchIndexer\sc.Xdb.Collection.IndexerSettings.xml
Since the interactions captured by Universal Tracker are not Page Views or Web visits, these interactions are filtered out by the WebVisit Interaction Filter. In order to disable this filter, go to the following config.
sitecorewebpath\App_Config\Sitecore\ExperienceAnalytics\Sitecore.ExperienceAnalytics.Aggregation.config
and key in the following line.
<InteractionFilter type="Sitecore.ExperienceAnalytics.Aggregation.Filters.WebVisitFilter, Sitecore.ExperienceAnalytics.Aggregation" />
Submitting Interactions
Interactions in Universal Tracker can be submitted either by using the Sitecore provided SDK or Postman.
Sitecore SDK
Here are the steps to send an Interaction to Universal Tracker using Sitecore SDK.
private static void Main(string[] args)
string instanceUrl = "http://sitecore.tracking.collection.service";
string channelId = "27b4e611-a73d-4a95-b20a-811d295bdf65";
string definitionId = "01f8ffbf-d662-4a87-beee-413307055c48";
var defaultInteraction = UTEntitiesBuilder.Interaction()
.ChannelId(channelId)
.Initiator(InteractionInitiator.Contact)
.Contact("jsdemo", "demo")
.Build();
using (var session = SitecoreUTSessionBuilder.SessionWithHost(instanceUrl)
.DefaultInteraction(defaultInteraction)
.BuildSession())
{
var eventRequest = UTRequestBuilder.EventWithDefinitionId(definitionId)
.Timestamp(DateTime.Now).Build();
var eventResponse = await session.TrackEventAsync(eventRequest);
Console.WriteLine("Track EVENT RESULT: " + eventResponse.StatusCode);
}
instanceUrl 🡺Url of the UAT collection service.
channelId 🡺 Guid of the channel used. This needs to be registered with Universal Tracker.
definationId 🡺 Guid of the event to be triggered (Goal, Outcome etc.)
using System;
using System.IO;
using System.Threading.Tasks;
using Sitecore.UniversalTrackerClient.Entities;
using Sitecore.UniversalTrackerClient.Request.RequestBuilder;
using Sitecore.UniversalTrackerClient.Session.SessionBuilder;
Postman
You can begin the submission of interactions to Universal Tracker, directly from Postman without writing a line of code.
Here are the available endpoints that can be used to submit or edit Interactions to Universal Tracker.
Endpoint: CollectionServiceUrl/interaction
Request Type: PUT
Request Body:
{
“Initiator”:””, //brand or contact
“ChannelId”:””, //channel id to be used
“UserAgent”:””, //user agent info
“Contact”: {
“Source”:””, //contact reference source
“Identifier”:”” //contact reference identifier
//If the contact with specified source and identifier is not found, a new contact will be created for same.
},
“Events”:{
“type”:””, //type of event; goal, outcome etc.
“definitionId”:””, //guid of the event type
“Timestamp”:”” //timestamp when the goal was triggered.
}
}
Response Code: 201
Response Content:
Tracking Interaction Id //this interaction id is used for subsequent additions
and submitting the interaction
Sample
Endpoint: CollectionServiceUrl/event
Request Type: PUT
Request Body:
[
{
“type”:””, //type of event; goal, outcome etc.
“definitionId”:”” //guid of the event type
“Timestamp”:”” //timestamp when the goal was triggered.
“TrackingInteractionId”:”” //tracking interaction id of the existing
interaction.
},
{
“type”:””, //type of event; goal, outcome etc.
“definitionId”:”” //guid of the event type
“Timestamp”:”” //timestamp when the goal was triggered.
“TrackingInteractionId”:”” //interaction id of the existing interaction.
}
]
Response Code: 201
Response Content:
Empty //An error would appear if the tracking
interaction id is not valid or the interaction
with the tracking id is not found.
Sample
Endpoint: CollectionServiceUrl/interaction/complete
Request Type: POST
Request Body:
{
TrackingInteractionId
Response Code: 202
Response Content:
true //An error would appear if the tracking
interaction id is not valid or the interaction
with the tracking id is not found.
Sample:
The interactions are not processed in real time but we can modify some settings in Sitecore.Tracking.Processing.Service\sitecore\Sitecore.Tracking.Processing.Engine\Config\config.xml to make it more efficient.
You should be able to view the Interactions along with the events submitted from Postman, on the experience profile of the recently created contact.
Altudo is a Sitecore Platinum partner with 500+ Sitecore projects delivered for 45+ Fortune 500 brands, across 7 industry verticals
We help you realize the true potential of your marketing efforts, speeding up the Time to Value by leveraging CX strategy, 1:1 personalization & our global delivery expertise.
Talk to us about how we bring together 1:1 personalisation, deep Martech Expertise, CX & Demand Gen Strategy, Engagement Analytics & Cross-Channel Orchestration to drive award winning experiences that convert
Get in touch for a complimentary consultation or a demo today.
Free workshops, expert advice & demos- to help your realize value with Sitecore
RegisterParticipate in our event survey , meet us at our booth , get free giveaways & a chance to win an iPhone 11
Let’s go