Track data server-side
Events tracked out-of-the-box
Following are the server-side events that Sitefinity Insight connector tracks out-of-the-box. You can use the events types and their corresponding handler classes to extend or override the default events. All data is reported via the Sitefinity Insight .NET SDK. For more information, see Capture server-side data with .NET SDK.
NOTE: All event handler classes below are exposed in the Telerik.Sitefinity.DataIntelligenceConnector.EventHandlers
namespace.
Event: Created comment
Predicate: Post comment
Object: The URL where the comment is posted
Event type: Telerik.Sitefinity.Services.Comments.CommentCreatedEvent
Insight Connector Event Handler Class: CommentCreatedTrackingHandler
Event: Downloaded document
Predicate: Download file
Object: The URL of the downloaded file
Event type: Telerik.Sitefinity.Modules.Libraries.Web.Events.MediaContentDownloadingEvent
Insight Connector Event Handler Class: MediaContentDownloadTrackingHandler
Event: Submitted form
Predicate: Submit form
Object: The title of the form submitted
Event type: Telerik.Sitefinity.Modules.Forms.Events.FormEntryCreatedEvent
Insight Connector Event Handler Class: FormEntrySubmittedTrackingHandler
Event: Created forum post
Predicate: Create forum post under
Object: The URL of the created forum post
Event type: Telerik.Sitefinity.Forums.Events.ForumPostCreatedEvent
Insight Connector Event Handler Class: ForumPostCreatedTrackingHandler
Event: Created forum thread
Predicate: Create forum thread
Object: The URL of the created thread
Event type: Telerik.Sitefinity.Forums.Events.ForumThreadCreatedEvent
Insight Connector Event Handler Class: ForumThreadCreatedTrackingHandler
Event: Subscribed to a forum thread
Predicate: Subscribe to forum thread
Object: The URL of the subscribed forum thread
Event type: Telerik.Sitefinity.Forums.Events.ForumThreadSubscriptionCreatedEvent
Insight Connector Event Handler Class: ForumThreadSubscriptionCreatedTrackingHandler
Event: Unsubscribed from a forum thread
Predicate: Unsubscribe from forum thread
Object: The URL of the unsubscribed forum thread
Event type: Telerik.Sitefinity.Forums.Events.ForumThreadSubscriptionDeletedEvent
Insight Connector Event Handler Class: ForumThreadSubscriptionDeletedTrackingHandler
Event: Subscribed to email campaign
Predicate: Subscribe to newsletter
Object: The name of the email campaign
Event type: Telerik.Sitefinity.Modules.Newsletters.Events.NewsletterSubscriptionCompletedEvent
Insight Connector Event Handler Class: NewsletterSubscriptionCreatedTrackingHandler
Event: Unsubscribed from email campaign
Predicate: Unsubscribe from newsletter
Object: The name of the email campaign
Event type: Telerik.Sitefinity.Modules.Newsletters.Events.NewsletterSubscriptionDeletedEvent
Insight Connector Event Handler Class: NewsletterSubscriptionDeletedTrackingHandler
Event: View personalized widget on page
Predicate: View personalized widget
Object: An empty string is sent as object
Event type: Telerik.Sitefinity.Personalization.Impl.Web.Events.IPersonalizedWidgetRenderEvent
Insight Connector Event Handler Class: PersonalizedWidgetTrackingHandler
Event: View personalized page
Predicate: View personalized page
Object: The absolute URL of the page
Event type: Telerik.Sitefinity.Web.Events.PagePreRenderCompleteEvent
Insight Connector Event Handler Class: PersonalizedPageTrackingHandler
Event: Logged in contact
Predicate: Login
Object: An empty string is sent as object
Event type: Telerik.Sitefinity.Web.Events.LoginCompletedEvent
Insight Connector Event Handler Class: UserLoginHandler
Event: User logout
Predicate: Logout
Object: An empty string is sent as object
Event type: Telerik.Sitefinity.Web.Events.ILogoutCompletedEvent
Insight Connector Event Handler Class: UserLogoutHandler
Event: Registered contact
Predicate: Register
Object: An empty string is sent as object
Event type: Telerik.Sitefinity.Security.Events.UserRegistered
Insight Connector Event Handler Class: UserRegisteredTrackingHandler
Event: Activated contact
Predicate: Activate User
Object: An empty string is sent as object
Event type: Telerik.Sitefinity.Security.Events.ProfileUserUpdated
Insight Connector Event Handler Class: UserActivatedTrackingHandler
Event: Created contact
Predicate: No predicate is sent
Object: No object is sent
Event type: Telerik.Sitefinity.Security.Events.UserCreated
Insight Connector Event Handler Class: UserCreatedTrackingHandler
Event: Created profile
Predicate: No predicate is sent
Object: No object is sent
Event type: Telerik.Sitefinity.Security.Events.ProfileCreated
Insight Connector Event Handler Class: UserProfileCreatedTrackingHandler
Event: Updated profile
Predicate: No predicate is sent
Object: No object is sent
Event type: Telerik.Sitefinity.Security.Events.ProfileUpdated
Insight Connector Event Handler Class: UserProfileUpdatedTrackingHandler
Create new data collection handlers
You can extend its core list of tracked events by creating your custom event handler – it is as simple as composing the contents of the request that you send to Sitefinity Insight. In the context of the Sitefinity Insight connector, this request is not considered the structure of the HTTP request but more specifically, the structure of the data you send to Sitefinity Insight.
In the sections below, you can see in details how to create your own data collection handlers, depending on the version of Sitefinity CMS you are working with.
- Create a new class that inherits the abstract class
InteractionsTrackingHandlerBase<T>
, where <T>
is one of the default events or a custom class implementing the IEvent
interface.
- Implement the abstract method
List<Interaction> ComposeInteractions(T @event)
.
- To register your new handler in Sitefinity backend, perform the following:
- Navigate to Administration » Settings » Advanced » DigitalExperienceCloudConnector » ServerHandlers.
- Click Create New.
- In HandlerTypeName, enter the full class name, including the namespace.
NOTE: Leave fields Title and Group empty because they are not used.
- Click Save changes.
- Recycle your Sitefinity CMS application.
The sample code below demonstrates how to create a custom handler that reports data to Sitefinity Insight when a new user is created in Sitefinity CMS:
Customize the out-of-the-box data collection
To customize the out-of-the-box data collection, you simply need to create a custom handler in the SitefinityWebApp project, which inherits from the handler responsible for the event you wish to modify. You need to:
- Override the
List<Interaction> ComposeInteractions(T @event)
method of the handler.
- Register the custom handler under Administration » Settings » Advanced » DigitalExperienceCloudConnector » ServerHandlers.
- Recycle your Sitefinity CMS website.
For a comprehensive list of available handler classes you can check the list in the beginning of this article or navigate to Administration » Settings » Advanced » DigitalExperienceCloudConnector » ServerHandlers.
The code sample below demonstrates how to modify the data sent to Sitefinity Insight once a form is submitted:
Work with the .NET SDK in the context of Sitefinity CMS
You can access and instantiate all of the Sitefinity Insight .NET SDK clients within your SitefinityWebApp project, just like you would outside of the project. For more information, see Data collection clients.
When working with the .NET SDK clients in the context of Sitefinity CMS, it is important to make sure that you use the same settings that the Sitefinity Insight connector uses:
- Sitefinity Insight data center API key
- Data source to which data is to be reported
The following sections provide you with recommendation about how to work with the .NET SDK, depending on the version of Sitefinity you have.
We recommend using the InteractionManager
class for data collection since it guarantees that data is reported using the Sitefinity Insight connector settings.
Following are the key properties and methods of the InteractionManager
class.
public string Source { get; }
Gets the Sitefinity Insight data source with which the Sitefinity Insight connector is set up. We recommend that you use this data source to report to Sitefinity Insight all custom interactions to Sitefinity Insight.
public bool IsUserAuthenticated { get; }
Checks whether the current user browsing your website is logged in.
public Interaction CreateInteraction(string predicate, string obj, string subject = null)
Creates a basic interaction with only a predicate and an object. If a subject is not provided, it is obtained by calling the GetInteractionSubject()
method.
public Interaction CreateInteraction(string predicate, string obj, Dictionary<string, string> objectMetadata, Dictionary<string, string> subjectMetadata, string subject = null)
Creates an interaction with object and subject metadata. If a subject is not provided, it is obtained by calling the GetInteractionSubject()
method.
public Interaction CreateInteraction(string predicate, string obj, string subject, Dictionary<string, string> objectMetadata, Dictionary<string, string> subjectMetadata, string subjectMappedTo)
Creates a complex interaction with metadata and mapping.
public Interaction CreateInteractionMapping(string userId, string trackingId = null)
Creates a mapping-only interaction. If a tracking ID is not provided, it is obtained by calling the GetTrackingId()
method.
public Interaction CreateInteractionSubjectMetadata(string subject, Dictionary<string, string> metadata)
Creates an interaction with subject metadata only.
public void SendInteraction(Interaction interaction)
Sends the provided interaction to Sitefinity Insight, using the settings with which the Sitefinity Insight connector is set up.
public void SendInteractions(List<Interaction> interactions)
Sends the provided interactions to Sitefinity Insight, using the settings with which the Sitefinity Insight connector is set up.
public virtual string GetInteractionSubject()
Returns the most appropriate subject with which to report your data, based on the following criteria:
- If the current user browsing the website is logged in, the method returns the user ID from the Sitefinity CMS database.
- If the current user is not logged in and there is a cookie, created by the Sitefinity Insight JavaScript SDK, the subject ID from that cookie is returned.
- If the user is not logged in, there is no Sitefinity Insight JavaScript SDK cookie and the user gave consent that their actions on the website are tracked, a new Sitefinity Insight JavaScript SDK cookie is created and the subject ID from it is returned.
public virtual string GetTrackingId()
Returns the tracking ID from the Sitefinity Insight JavaScript SDK cookie. Note that if there is no Sitefinity Insight JavaScript SDK cookie and the user gave consent that their actions on the website are tracked, a new Sitefinity Insight JavaScript SDK cookie is created and the subject ID from the cookie is returned.
The following code example demonstrates how to get an instance of the InteractionManager
class and send an interaction with it:
If you want to use some of the Sitefinity Insight .NET SDK clients that need authentication, for example the Personalization clients or A/B test clients, we recommend using the IDataIntelligenceConnectorConfigWrapper
interface and the InteractionManager
class to make sure that you are using the same settings as the Sitefinity Insight connector.
The following table lists the key properties in the IDataIntelligenceConnectorConfigWrapper
.
Property |
Description |
string ApiServerUrl { get; set; } |
The URL of the Sitefinity Insight API Server the Sitefinity Insight connector reports data to. |
string DecAppUrl { get; set; } |
The URL of the Sitefinity Insight Web app. |
string TrackingCookieDomain { get; set; } |
The tracking domain as set in the Sitefinity Insight JavaScript SDK cookie. For more information, see Manage cookies. |
string ApplicationName { get; set; } |
The Sitefinity Insight data source with which the Sitefinity Insight connector reports all of the data. |
string AccessKey { get; set; } |
Returns the access key token that you use to issue an authorization token. |
string UserName { get; set; } |
IMPORTANT: From Sitefinity 12.1 onward, this property is marked as obsolete. Use the AccessKey property instead.
Returns the username of the Telerik account the Sitefinity Insight connector is set up with.
|
string Password { get; set; } |
IMPORTANT: From Sitefinity 12.1 onward, this property is marked as obsolete. Use the AccessKey property instead.
Returns the password of the Telerik account the Sitefinity Insight connector is set up with.
|
bool IsConnected { get; set; } |
Indicates whether the Sitefinity Insight connector established a successful connection with Sitefinity Insight. |
string GetApiKeyForCurrentSite(); |
Returns the API Key of the Sitefinity Insight data center the current Sitefinity CMS site reports its data to, as per the Sitefinity Insight connector setup. |