@survicate/survicate-web-package
v24.18.16-npm
Published
Survicate Web Package
Downloads
20,590
Keywords
Readme
Survicate Web Package
This package allows you to run a web survey directly in your code. It's built on top of Preact using Typescript and CSS Modules.
Installation
npm install @survicate/survicate-web-package --save
Initialization
Find your workspace key in the Survicate Panel.
import Survicate from '@survicate/survicate-web-package/survicate_widget'
const key = "..." // Your key from the panel
Survicate.init({workspaceKey: key});
Examples:
To call available methods:
import Survicate from '@survicate/survicate-web-package/survicate_widget'
// Initialize survicate:
const key = "..." // Your key from the panel
Survicate.init({workspaceKey: key});
// Show survey with force option
Survicate.showSurvey('surveyId', { forceDisplay: true });
// Set user attributes
Survicate.setVisitorTraits({name: 'userName', lastName: 'userLastName'});
// Add event listener
Survicate.addEventListener(ApiEvent.questionAnswered , () => console.log('question answered'));
// Remove eventListener
Survicate.removeEventListener(ApiEvent.questionAnswered);
Please refer to the documentation for the rest of the methods.
Changelog
The Survicate JavaScript SDK changelog can be found here