JavaScript SDK

Integrate the Wondering snippet on your website using the JavaScript SDK.

Getting started

Installation

To integrate Wondering on your website, simply add this JavaScript snippet to your web application:

<!-- Wondering Integration Snippet -->
<script type="text/javascript">
(function(w,o,n,d,e,r,ing) {
        window.wondering = function(){W._q.push(arguments)}
        var W = window.wondering; W.wonderingID = n; W.env = o; W._q = [];
        s=w.createElement('script');
        s.async=!0;s.src=o+'?wid='+W.wonderingID;
        f=w.getElementsByTagName('script')[0];
        f.parentNode.insertBefore(s, f);
    })(document, 'https://cdn.wondering.com/wondering.js', 'YOUR_WONDERING_ID');
</script>

Replace YOUR_WONDERING_ID with your own Wondering ID, which you can find on the JavaScript SDK page in your Wondering account.

Add the snippet to every page in your web application that you want to recruit research participants from. You can add this snippet anywhere on your page, but for the best performance we recommend adding it as the first item in the tag.

You may also need to allow Wondering's domains to your site's permissions policy in order for users to respond to studies using the microphone:

Permissions-Policy: microphone=(self "https://cdn.wondering.com" "https://api.wondering.com")