Foresee | Bi-directional

This article will describe how to integrate with the Foresee Feedback Solution, provided as part of their Web SDK. We have given two examples below of the most common data sent between the two analytic tools.  

The ForeSee CX Suite is a customer experience (CX) intelligence platform, helping companies prioritise CX decisions and the profit from their users feedback. The suite has many solutions available, this article focuses on the Foresee feedback service. 

If you would like to include other functionality, the help articles listed below will take you to the respective help sites where you will be able to find many other Foresee and SessionCam methods to use. 

Examples:

Sending Data to SessionCam

Say we wanted to filter all recordings in SessionCam that filled in a Foresee feedback survey and had given 3 stars or less

The main elements we will use are: 

  • The Foresee FsReady() function
  • The FSR.onFeedbackSubmitted method and 
  • The SessionCam sessioncamConfiguration.customDataObjects method

These are linked to here:

Foresee: 

https://developer.foresee.com/docs/sdk-extension-points

https://developer.foresee.com/docs/api-event-hooks

SessionCam:

https://help.sessioncam.com/hc/en-gb/articles/360001041714-How-to-set-up-a-Custom-Variable 

The Foresee onFeedbackSubmitted method will be called when a survey is successfully submitted. It will send a collection of items across when it is fired that can be queried, these include:

  • rating (integer) - how many stars
  • url (string) - the current url someone is visiting on the site
  • responses (array of objects) 

The example code below fires a SessionCam Custom Variable to SessionCam, if the Foresee Survey rating is less than three when it is submitted.


  fsReady(function() {
  	FSR.onFeedbackSubmitted.subscribe(function(items) {
    
  		//if rating is 3 or less
  		if (items.rating <= 3) {
      
  		//check if sessionCamConfiguration has been initialised, and initialise if needed.
  			if (!window.sessioncamConfiguration)
  				window.sessioncamConfiguration = new Object();
          
  			//check if customDataObjects has been initialised, and initialise if needed.
  			if (!window.sessioncamConfiguration.customDataObjects)
 					window.sessioncamConfiguration.customDataObjects = [];
          
  			/** You can edit the values below for key and value to send the data you want**/
  			var item = {
 					key: "feedback_submitted",
 					value: "three-or-less"
 				};
 				window.sessioncamConfiguration.customDataObjects.push(item);
} }, true, true); });

Notes:

The Foresee function onFeedbackSubmitted was added in version 19.3.3 (Released on May 5, 2017) please check with your Foresee account manager if you feel you may have an older version than this. 

Sending Data to Foresee

In this example we will send the SessionCam Session ID to Foresee (this ID can be used to replay a session from a URL)  

The main elements we will use are:

  • The Foresee FsReady() and 
  • Customer Passed Parameters functions
  • The Sessioncam sessionID() and 
  • sessioncamConfiguration.notifications callback functions 

These are linked to here:

Foresee:

https://developer.foresee.com/docs/sdk-extension-points 

https://developer.foresee.com/docs/customer-passed-parameters

SessionCam:

https://help.sessioncam.com/hc/en-gb/articles/200871038-What-is-a-Session-ID-

This code waits for the SessionCam ID to be available using the SessionCam callback function. Then sends a Customer Passed Parameter through to the Foresee survey, ready to be sent if someone completes a survey during their session.


  scsessionstarted = function(sc) {
  	fsReady(function() {
 			FSR.CPPS.set('SessionCam-replay-link', 'https://console.sessioncam.com/Console/Recordings/PlaybackSession?sessionId=' + sc.sessionId);
 		})
  };

  if (!window.sessioncamConfiguration) {
  	window.sessioncamConfiguration = new Object();
  }
  
  sessioncamConfiguration.notifications = [{
  	event: 'session/started',
  	listener: scsessionstarted
  }];