For developers: Create custom tracking event handlers
NOTE: Sitefinity Digital Experience Cloud (DEC) was renamed to Sitefinity Insight as a part of the Sitefinity 13.0 release. However, Sitefinity CMS and its documentation prior to version 13.0 continue using the former name - Digital Experience Cloud.
The Progress Sitefinity Digital Experience Cloud connector enables you to extend its core list of tracked events. You can easily create your custom event handler – it is as simple as composing the contents of the request that you send to Progress Sitefinity Digital Experience Cloud. In the context of Progress Sitefinity Digital Experience Cloud connector, this request is not considered the structure of the HTTP request, but more specifically, the structure of the data you send to Progress Sitefinity Digital Experience Cloud.
- To create a new event handler, you simply inherit one of the following classes:
- Compose data by implementing the Compose* method of the respective class:
- ComposeSentences(T theEvent) for SentencesTrackingHandlerBase<T> method
- ComposeSubjectMetadata(T theEvent) for SubjectMetadataTrackingHandlerBase<T> method
- ComposeMappings(T theEvent) for MappingsTrackingHandlerBase<T> method
- Register the handler in the Progress Sitefinity Digital Experience Cloud connector configuration file. To do this:
- In Sitefinity CMS, navigate to Administration » Settings » Advanced » DigitalExperienceCloudConnector.
- According to the type of event handler class you inherited, register your new handler in the corresponding section:
- ServerHandlers (for sentence handlers)
- MappingHandlers
- SubjectMetadataHandlers
NOTE: Make sure you fill in the HandlerType name filed. The other fields may vary depending on the type of handler.
- Recycle your application.
Following is an example of a custom event handler implementation:
public
class
UserCreatedTrackingHandler : SentencesTrackingHandlerBase<UserCreated>
{
public
override
List<Sentence> ComposeSentences(UserCreated @
event
)
{
string
subject = @
event
.UserId.ToString();
string
obj = SystemManager.CurrentHttpContext.Request.Url.AbsolutePath;
string
predicate =
"Created Account"
;
List<Sentence> sentences =
new
List<Sentence>()
{
this
.SentenceMng.CreateSentence(
predicate,
obj,
new
Dictionary<
string
,
string
>() { {
"PageTitle"
,
"The page title"
} },
new
Dictionary<
string
,
string
>() { {
"Username"
, @
event
.UserName }, {
"Email"
, @
event
.Email } },
subject)
};
return
sentences;
}
}