Installing the script
The Scalar script enables surveys and widgets on your website. Follow these steps to install it.
Step 1: Copy the embed code
- Go to Settings > Scalar Script (in the API & Integrations section)
- Click Copy to copy the embed script to your clipboard
The script looks like this:
<script src="https://your-workspace.scalar.co.za/widget-loader.js"></script>
<script>
window.ScalarWidget.init({
companySlug: 'your-company',
testToken: 'abc123...'
});
</script>
Step 2: Add to your website
Paste the script into your website's HTML, just before the closing </body> tag:
<!DOCTYPE html>
<html>
<head>
<title>Your Website</title>
</head>
<body>
<!-- Your website content -->
<!-- Scalar Script - place before closing body tag -->
<script src="https://your-workspace.scalar.co.za/widget-loader.js"></script>
<script>
window.ScalarWidget.init({
companySlug: 'your-company',
testToken: 'abc123...'
});
</script>
</body>
</html>
Step 3: Verify installation
- Return to Settings > Scalar Script
- Click Check status
- Visit your website in a browser to trigger the connection test
- Return to Settings and click Check status again
If successful, you'll see "Script installed" with a green badge.
Installing via Google Tag Manager
If you use Google Tag Manager (GTM):
- Log in to your GTM account
- Create a new Custom HTML tag
- Paste the Scalar embed script
- Set the trigger to All Pages
- Save and publish your container
See the Google Tag Manager installation guide for detailed instructions.
Troubleshooting
Script not detected
If the script status shows "Script not installed":
- Check placement: Make sure the script is before the closing
</body>tag - Check for typos: Verify the script was pasted correctly without modifications
- Clear cache: Try a hard refresh (Ctrl+Shift+R or Cmd+Shift+R)
- Check console: Open browser developer tools and look for JavaScript errors
- Disable blockers: Some ad blockers or privacy extensions may block the script
Surveys not appearing
If surveys aren't showing:
- Check publish status: Make sure the survey is published
- Check targeting: Verify the survey's page location settings match your page
- Check display rules: Review "show once" settings; the survey may have already been shown
- Check timing: If using a trigger delay, wait for the specified time
Security notes
- The script loads from your unique workspace URL
- Connection is always over HTTPS
- User data is isolated to your company
- The test token is only used for verifying installation
Next steps
Once the script is installed, you can:
- Identify users for personalised surveys and segmentation
- Create surveys that appear on your website
- Configure widget display settings in survey options
