Documentation
Installation
Paste the snippet into the <head>
section or alternatively before the ending </body>
tag on every page you wish to run Surveybox surveys on.
Make sure to enter your app_key
and replace the customer@example.com
placeholder with a unique identifier for each of your users, we suggest using their email. If you want to, you can also include an avatar URL and it will show up in your reports.
<!-- Surveybox -->
<script>
window.Surveybox = {
app_key: "your-app-key", // Provide your key
user: "customer@example.com", // Replace this with your customers email
avatar: "", // Optionally provide an avatar URL for your customer
};
</script>
<script src="https://static.surveybox.io/surveybox.js" defer></script>
The window.Surveybox
object
The window.Surveybox
object is where you provide our widget with your app_key and additional settings when installing Surveybox. We also expose some functionality through the object so you can fine-tune how your applications interacts with Surveybox.
window.Surveybox = {
app_key: String, // Your app key
user: String, // A unique identifier for the user
avatar: String, // An avatar URL
suppress: Boolean, // If you want to suppress the trigger check
};
window.Surveybox.makeRequest
The window.Surveybox
object exposes a method called makeRequest
that can be used to programmatically trigger the survey check. This should be combined with the suppress
parameter and can be used to fine-tune the timing at which the check is performed.
Example:
<!-- Surveybox -->
<script>
window.Surveybox = {
app_key: "my-app-key",
user: "my.customer@example.com",
suppress: true,
};
</script>
<script src="https://static.surveybox.io/surveybox.js" defer></script>
<script>
// Your application
// ... do a bunch of stuff
window.Surveybox.makeRequest();
</script>