The JavaScript SDK supports HTML instrumentation functionality that makes reporting data to Sitefinity Insight on some interactions with the HTML elements on your page easier. For example, you can track clicks on buttons, links, or images on your page, expanding dropdown menus, and so on.
You can use this functionality, for example, to track steps of the visitor’s journey, such as clicking CTAs, clicking links to external sites, or interacting with an important UI element.
If you are using the Sitefinity Insight JavaScript SDK outside of Sitefinity CMS, this functionality is turned off. To enable HTML instrumentation, when instantiating the SDK client, set the constructor's instrument parameter to true.
instrument
true
NOTE: Tracking HTML elements is turned on by default in Sitefinity CMS.
Once enabled, HTML instrumentation detects the following element attributes, which you can then add to any HTML element inside your web pages:
sfdi-trigger
sfdi-predicate
sfdi-object
sfdi-obj-metadata
The object metadata of the reported interaction. Note that the attribute value must be a stringified object of string properties, for example: '{\"pageTitle\": \"Home Page\", \"pageAuthor\": \"John Smith\"}'.
'{\"pageTitle\": \"Home Page\", \"pageAuthor\": \"John Smith\"}'
location.href
ReferrerUrl
sfdi-sub-metadata
'{\"browser-name\": \"Chrome\", \"os\": \"Windows\"}'
The example below demonstrates how to use HTML instrumentation to report data to Sitefinity Insight when a user clicks on a specific link:
To submit feedback, please update your cookie settings and allow the usage of Functional cookies.
Your feedback about this content is important