Adding embedded code within website

Updated 

Website Distribution enables companies to obtain immediate feedback from their website visitors by integrating surveys on selected web pages. This feature assists in collecting information about user experience, preferences, and behaviors, allowing for data-informed decisions to enhance website usability and performance. By thoughtfully positioning surveys, businesses can effectively target pertinent feedback while monitoring essential metrics such as engagement and completion rates.

After creating a website distribution, you can copy the embed code from the Vertical Ellipsis menu and paste it into your website’s HTML to start triggering surveys for your visitors. You can refer to the article on website distribution for more details on use cases and value additions.

Prerequisites

In order to access the Website Distribution, you must have the following View and Edit Distribution permissions at the Survey Level.

Accessing Embedded Code

  1. After creating a website distribution, click the Vertical Ellipsis (3 dots) and copy the embed code.

  2. Paste the embed code in the HTML of your website to start triggering surveys.

How to implement on a website?

This document details the implementation of the Sprinklr Website Survey or Live Chat widget across diverse web platforms. The provided JavaScript code loads the widget asynchronously and dynamically, ensuring no adverse effect on page performance.

  1. Static Websites (HTML / PHP)

    1. Add the full script before the closing tag on all pages.

    2. Deploy through staging environment first.

    3. Validate using browser developer tools (Network & Console tabs).

      Examples

  2. CMS Platforms (WordPress, Drupal, Joomla)

    1. Use header/footer injection plugins or theme settings.

    2. Avoid editing core theme files directly.

    3. Test after theme updates.

  3. Single Page Applications (React / Angular / Vue)

    1. Add script inside public/index.html or root layout file.

    2. Ensure script loads only once during application bootstrap.

    3. Avoid re-initializing on route changes.

  4. Enterprise Deployment (Tag Manager Recommended)

    1. Create a Custom HTML Tag in your Tag Management System.

    2. Set appropriate triggers (All Pages or specific URLs).

    3. Publish after validation in preview mode.

Security & Performance Consideration

  • Ensure Content Security Policy (CSP) allows Sprinklr domain.

  • Widget loads over HTTPS and asynchronously.

  • Trigger survey only after consent where required (GDPR/CCPA).

Post-Deployment Validation Checklist

  • Script visible in page source.

  • Network call to Sprinklr handshake URL is successful.

  • No console errors.

  • Widget loads and displays correctly