The JavaScript endpoints outlined below can be called in your website pages to further enhance or customize Decibel functionality.
Events
The following events can be used to trigger website functionality and other data integrations based on Decibel behaviors:
decibelInsight('ready', callback); |
In some cases, JavaScript code must be executed after Decibel has been fully loaded. This event allows custom code to be executed once this condition has occurred. You can bind one or more callbacks to be executed in the same order they were bound. |
Argument
|
Example // Log a message in the console once Decibel is fully loaded. |
decibelInsight('onCollectionChange', callback); |
This event will be triggered when the collection status of Decibel changes. |
Argument
|
Example // Log a message in the console whenever Decibel starts collecting data. |
decibelInsight('onPageCollected', callback); |
In some cases, JavaScript code must be executed after Decibel has been fully loaded and all page information has been collected. This event allows custom code to be executed once this condition has occurred. You can bind one or more callbacks, which will be executed in the same order they were bound. |
Argument
|
Example // Log a message in the console once Decibel is fully loaded and the page is collected. |
decibelInsight('onHTMLCollected', callback); |
In some cases, JavaScript code must be executed after Decibel has been fully loaded and the HTML of the current page has been collected. This event allows custom code to be executed once this condition has occurred. You can bind one or more callbacks, which will be executed in the same order they were bound. |
Argument
|
Example // Log a message in the console once Decibel is fully loaded and HTML of the current page collected. |
Collection
The functions below can be used to send additional information to Decibel:
formSubmitted
decibelInsight('formSubmitted', form); |
This function informs Decibel of nonstandard form submissions, such as AJAX submission. |
Argument
|
Examples // Trigger submission of a form identified by DOM element. |
sendApplicationError
decibelInsight('sendApplicationError', message, [asSelector]); |
This function informs Decibel of application errors experienced by a visitor. |
Arguments
|
Examples // Pass a specific application error message to Decibel. |
sendCustomDimension
decibelInsight('sendCustomDimension', dimension, value); |
This function sets custom information against a visitor, session, or pageview. Note: Before using this function, you must configure custom dimensions for the website.
|
Arguments
|
Examples // Send Custom Dimension data with a fixed value. |
sendTrackedEvent
decibelInsight('sendTrackedEvent', name, [value], [currency]); |
This function triggers tracked events. The tracked event value and currency can also be set. |
Arguments
|
Examples // Trigger a tracked event with no value attached. |
sendHTTPError
decibelInsight('sendHTTPError', code); |
This function informs Decibel of HTTP server errors. |
Argument
|
Example // Inform Decibel that the current page |
trackCanvas
decibelInsight('trackCanvas', canvas); |
Tracks the content of a canvas to ensure accurate reflection in the session replay. This function can be used when a large or heavily animated canvas is present on the page and when automated canvas tracking is not desired. |
Argument
|
Examples // Track a canvas identified by DOM element. |
trackPageView
decibelInsight('trackPageView', [path], [params]); |
Websites using JavaScript functionality to change page content without performing a page reload must use the Decibel JavaScript API to trigger pageviews. |
Arguments
|
Example decibelInsight('trackPageView', '/About-Us'); |
updateUserId
decibelInsight('updateUserId', userID); |
Provides a custom user ID for the current visitor. This is usually an ID generated from a website's login area. It can be used to enable integration of Decibel data with existing internal systems, such as CRM. |
Argument
|
Example // Assign a customer ID from the JavaScript data layer Important: Do not pass any personal details, such as the user's name or email address,
and avoid passing simple incrementing user IDs (for example, 12345). Decibel recommends sending a user ID hash using a hash function, such as MD5 or SHA1. |
Session control
The following functions provide granular control over the collection of sessions by Decibel:
decibelInsight('endSession'); |
Forces Decibel to stop collecting any further data for the current session |
Example // Force Decibel to end the current session. |
decibelInsight('startSession', [newVisitor]); |
Forces Decibel to initiate a session and start collecting data. If a session is currently in progress, this function will have no effect. |
Argument
|
Example // Force Decibel to start a session, for a new visitor profile. |
decibelInsight('restartSession', [newVisitor]); |
Forces Decibel to end the current session and start recording a new session. This function is equivalent to calling both the decibelInsight('endSession') and decibelInsight('startSession') functions consecutively. |
Argument
|
Example // Force Decibel to end the current session and start a new session. |
Connect
The following functions support connection between Decibel and other analytics tools:
decibelInsight('getLeadId'); |
Returns the Decibel lead ID for the current session |
Return
|
Example // Add the Decibel Lead ID to the JavaScript data layer. |
decibelInsight('getSessionId'); |
Returns the Decibel session ID for the current session. |
Return
|
Example // Add the Decibel Session ID to the JavaScript data layer. |
decibelInsight('isCollecting'); |
Determines if Decibel is successfully collecting data |
Returns
|
Example // Log a message in the console if Decibel is collecting data. |
Sampling
The following functions provide control over the use of sampling in Decibel:
decibelInsight('setCollection', status, [remember]); Note: Decibel recommends only customers with data-credit subscriptions use this API.
|
Enables or disables collection of data by Decibel. If the visitor is not being tracked, the visitor will be forced into the collection sample. If the visitor is being tracked, the visitor will be removed from the sample. |
Arguments
|
Examples // Enable collection for the current session |
decibelInsight('setRetention'); Note: Decibel recommends only customers with data-credit subscriptions use this API.
|
Enables retention of data by Decibel if retention sampling is enabled. If the visitor is not being tracked, the visitor will be forced into the retention sample. If retention sampling is not enabled, this function will have no effect. |
Example // Force the current session to be retained by Decibel. |
decibelInsight('selectSessionForExperience', status, [remember]); |
Enables or disables collection of data by Decibel. If the visitor is not being tracked, the visitor will be forced into the collection sample. If the visitor is being tracked, the visitor will be removed from the sample. |
Arguments
|
Examples // Enable collection for the current session |
decibelInsight('selectSessionForReplay', status, [remember]); |
Enables or disables collection of replay data by Decibel. If the visitor is not being tracked, the visitor will be forced into the replay collection sample. If the visitor is being tracked, the visitor will be removed from the sample. This function will only take effect if the session is in the experience data sample. |
Arguments
|
Examples // Enable replay collection for the current session |
decibelInsight('selectSessionForAnalysis', status, [remember]); |
Enables or disables collection of analysis data by Decibel. If the visitor is not being tracked, the visitor will be forced into the analysis collection sample. If the visitor is being tracked, the visitor will be removed from the sample This function will only take effect if the session is in the experience data sample. |
Arguments
|
Examples // Enable analysis collection for the current session |
decibelInsight('selectPageviewForAnalysis', status); |
Enables or disables collection of analysis data by Decibel. If the page is not being tracked, the page will be forced into the analysis collection sample. If the page is being tracked, the visitor will be removed from the sample This function will only take effect if the session is in the experience data sample. |
Argument status (boolean): New analysis collection status for the current page |
Examples // Enable analysis collection for the current page |
decibelInsight('setFavorite', [retention]); |
Indicates that the session replay should be added as a favorite when processed. |
Argument
|
Examples // Mark the session to be added as a favorite. |
Session replay functions
These functions allow configuration of session replay recording throughout a visitor’s journey:
decibelInsight('pauseRecording', [delay]); |
Pauses the recording of visitor replay. This may be necessary before initiating a complex animation to ensure that there is no reduction in frame rate for a short period of time. |
Argument
|
Examples // Pause recording for the remainder of the current |
decibelInsight('resumeRecording'); |
Resumes recording of visitor replay. This can be used if the pauseRecording endpoint was called without a delay parameter or to resume recording before the specific delay has passed. If called when recording is not paused, this endpoint will have no effect. |
Example // Resume recording if it has previously been |
decibelInsight('setFrameRate', rate); |
Sets the frame rate for visitor journey recordings. |
Argument
|
Example // Reduce the frame rate to two frames per second. |
Comments
0 comments
Please sign in to leave a comment.