I want to handle turning on/off sf-trckngckie cookie when the user switches the option accept/reject the sf-trckngckie cookie on UI.
https://community.progress.com/s/article/how-to-turn-off-sf-trckngckie-cookie
Please help to resolve it.
You can check the code of the Telerik.Sitefinity.Clients.JS.StatsClient.debug.js file with JustDecompile (Telerik.Sitefinity.dll) OR just inspect the javascript requests from a page and you will find it in one of the WebResource.axd requests.
This is what the LogVisit method looks like (which creates the cookie)
LogVisit: function (pageNodeId, randomId) {
var that = this;
var logVisit = function (pageNodeId, randomId) {
if (!that._canTrack) return;
var trackingCookieName = "sf-trckngckie"
var trackingId = that.readCookie(trackingCookieName);
if (!trackingId) {
trackingId = randomId;
that.createCookie(trackingCookieName, trackingId, 180);
}
// ... some code omitted
if (window.personalizationManager) {
window.personalizationManager.addPersonalizedContentLoaded(function () {
logVisit(pageNodeId, randomId);
});
} else {
logVisit(pageNodeId, randomId);
}
}
And the randomId parameter is really a Guid.NewGuid() assigned from the server.