...
Code Block | ||
---|---|---|
| ||
// Global object to keep track of sessionCam data
var mopSessionCam = {};
mopSessionCam.sessionId = '';
mopSessionCam.sessionCamReplayLink = '';
// event to update website data elements if survey is already loaded
const updateWebsiteData = new CustomEvent('mopinion_data');
// Use SC recorder data if already loaded
if (window.sessionCamRecorder && window.sessionCamRecorder.sessionId()) {
mopSessionCam.sessionId = window.sessionCamRecorder.sessionId();
mopSessionCam.sessionCamReplayLink = `https://console.sessioncam.com/Console/Recordings/PlaybackSession?sessionId=${window.sessionCamRecorder.sessionId()}`;
document.dispatchEvent(updateWebsiteData);
}
scsessionstarted = function(sc) {
// update keys on global object when sessionId becomes available after initialization of this script
mopSessionCam.sessionId = sc.sessionId;
mopSessionCam.sessionCamReplayLink = `https://console.sessioncam.com/Console/Recordings/PlaybackSession?sessionId=${sc.sessionId}`;
document.dispatchEvent(updateWebsiteData);
};
if(!window.sessioncamConfiguration) {
window.sessioncamConfiguration = new Object();
}
sessioncamConfiguration.notifications = [{
event: 'session/started',
listener: scsessionstarted
}]; |
...