Script: End Session

This article will help you End Session


Background

You may need to end your session right away so a respondent can come back and take a survey multiple times. 

  • Examples of why you would need to do this are: 
    • If you needed to have a landing page. 
    • If the end client wants to test multiple times using the Live link so they can see what a real respondent would see

Implementing the End Session

  1. Turn off Digital Fingerprinting, if you have not already, for the specific sample sources needed. This will turn off the termination tied to use of the same machine/ip address. 
  2. Get the 'Project ID' you are working on
  3. Access the Survey Authoring Tool (SAT) 
  4. Click on 'Survey Settings' followed by 'Default Text' to open that Card in the main screen  
  5. Click on the HTML Editor icon tied to the 'Survey Header' 
  6. Access the Source Code Editor (</>)
    • See Article: Source Code Editor
    • While in the Source Code Editor, add the following code and update the '99999' with the one you got in step 2 above
      <script>
      	function clearSession(projectId)
      	{
      		document.cookie = 'cmix-rid-prj-' + projectId + '=;expires=Thu, 01 Jan 1970 00:00:00 UTC;path=/';
      		document.cookie = 'cmix-rid-test-' + projectId + '=;expires=Thu, 01 Jan 1970 00:00:00 UTC;path=/';
      		document.cookie = 'cmix-rid-rt-' + projectId + '=;expires=Thu, 01 Jan 1970 00:00:00 UTC;path=/';
      	}
      	clearSession(99999); /*UPDATE PROJECT ID HERE*/
      
      
      </script>
      		
  7. You are done

  • NOTE
    • If this was done just for testing as a live person by the end client, you will want to: 
      • Turn Fingerprinting back on if you do not want the same machine/ip address to be able to take the survey multiple times
      • Remove the End Session code
Did this answer your question? Thanks for the feedback There was a problem submitting your feedback. Please try again later.