SurveySensum allows users to embed surveys directly into their web applications or websites using an embed code.
Once the code is generated and added to your application's HTML, the SurveySensum widget gets installed and exposes JavaScript methods that allow you to control survey behavior, pass respondent information, and manage survey interactions.
Using these methods, you can:
Start a survey using a JavaScript trigger.
Pass respondent information to the survey.
Remove previously stored respondent information.
Close an active survey.
When to use it: Use the embed code integration when you want to display SurveySensum surveys within your website or web application and control them through JavaScript.
Once you have generated the embed code:
Copy the generated code.
Paste it anywhere between the <head></head> tags of your HTML code.
Save your changes.
After adding the code, the SurveySensum widget will be installed on your website or web application.
The installed widget exposes several JavaScript methods that you can use to control survey behavior.
The SurveySensum widget provides the following methods:
The startSurvey(<JAVASCRIPT_TRIGGER>) method is used to start a survey using a JavaScript trigger.
The setUserInfo(<userData>) method allows you to pass respondent information to the SurveySensum widget.
The userData parameter is passed as an object.
Example:
const userData = {
Name: 'Bernard Donley',
Email: 'bernard@company.com'
};
The keys in the userData object must exactly match the Contact Property names configured in the SurveySensum portal. Property names are case-sensitive.The removeUserInfo() method removes any previously stored user information from memory.
The closeSurvey() method closes the survey if one is currently running.
You can access the SurveySensum widget through the window object using window.surveysensum.
Use the following syntax to execute the available methods:
Start a Survey:
window.surveysensum.startSurvey(<JAVASCRIPT_TRIGGER>);Pass Respondent Information:
window.surveysensum.setUserInfo(userData);Similarly, you can use the following methods:
Remove Respondent Information:
window.surveysensum.removeUserInfo();Close an Active Survey:
window.surveysensum.closeSurvey();