Install the Novella Website widget

This guide shows how to add the Novella Website widget to your site so you can collect feedback and see privacy-conscious traffic context alongside survey responses.

What You Can Do with This Widget

Once installed, the Website widget can:

  • Show feedback buttons and targeted surveys on your site
  • Compare sentiment across journey pages, campaigns, UTM parameters, and referrers
  • Record pageviews and route changes for privacy-conscious traffic context
  • Personalize surveys using respondent details you already have
  • Wait for consent before loading, if your site requires it

Before You Start

  • Make sure you have a Novella workspace with an active Website widget.
  • Copy the public workspace key from the Novella installation screen. This key is safe to use in browser code.
  • Make sure you have access to your website template or tag manager.
  • Keep server secrets and Tinybird ingestion tokens on your server.

Install the Widget

  1. Copy the script below.
  2. Replace YOUR_WORKSPACE_KEY with your public Novella workspace key.
  3. Add the script once on every page where the widget should appear, either immediately before </body> or in <head> with defer.
<script
  defer
  src="https://surveys.novellahq.com/widgets/1.0/novella.js"
  data-workspace="YOUR_WORKSPACE_KEY">
</script>

Once loaded, the script retrieves your active widget settings and evaluates their URL, trigger, priority, and frequency rules in the visitor's browser.

Add Optional Respondent Information

If your website or tag manager knows the visitor, you can pass optional personalization values.

<script
  defer
  src="https://surveys.novellahq.com/widgets/1.0/novella.js"
  data-workspace="YOUR_WORKSPACE_KEY"
  data-firstname="{{ first_name }}"
  data-lastname="{{ last_name }}"
  data-email="{{ email }}"
  data-company="{{ company_name }}">
</script>
AttributePurpose
data-workspaceRequired public key used to retrieve your active widgets.
data-firstnameOptional first name of the respondent.
data-lastnameOptional last name of the respondent.
data-emailOptional email address of the respondent.
data-companyOptional company name of the respondent.
data-autoloadSet to false to wait for consent before starting the widget.
data-analyticsSet to false to disable website pageviews.

Personalization is included in an encrypted, short-lived widget token. The survey iframe URL and traffic event payload omit these values. Novella ignores unresolved template placeholders.

If your consent manager must authorize feedback or analytics before the widget starts, set data-autoload="false".

<script
  defer
  src="https://surveys.novellahq.com/widgets/1.0/novella.js"
  data-workspace="YOUR_WORKSPACE_KEY"
  data-autoload="false">
</script>
<script>
  function onNovellaConsentGranted() {
    window.NovellaWebsiteWidget?.load();
  }
</script>

Call load() once consent is granted and the script is available. Until that call, the widget skips configuration requests and Novella website pageviews.

Show Surveys Without Website Pageviews

To keep feedback surveys enabled while disabling Novella's lightweight website analytics, set data-analytics="false".

<script
  defer
  src="https://surveys.novellahq.com/widgets/1.0/novella.js"
  data-workspace="YOUR_WORKSPACE_KEY"
  data-analytics="false">
</script>

Survey interaction events are still recorded after a respondent opens a survey.

What Traffic Information Is Collected

When website analytics is enabled, the runtime records an initial pageview and distinct client-side route changes. Novella stores the following information.

  • A page URL with the query string and fragment removed
  • An origin-only referrer
  • Allowlisted UTM campaign fields
  • The type of a recognized advertising click ID, with its value omitted
  • Pseudonymous visitor, session, and event identifiers
  • The workspace and widget associated with the pageview

When a visitor submits feedback, Novella can relate that sentiment to the page, referrer, and campaign context using shared visitor and session identifiers. Novella excludes IP addresses and user-agent strings from that matching process.

Content Security Policy

If your site uses Content Security Policy (CSP), merge these sources into the corresponding directives in your existing policy.

DirectiveSource to allow
script-srchttps://surveys.novellahq.com/widgets/1.0/novella.js
connect-srchttps://surveys.novellahq.com/api/widgets/
frame-srchttps://surveys.novellahq.com

Keep the other sources your application requires.

Subresource Integrity

A security scanner may flag the widget script because it lacks an integrity attribute. Subresource Integrity (SRI) lets the browser check a downloaded script against an expected cryptographic hash before running it. If the script changes and its hash no longer matches, the browser blocks it.

For a script hosted on a different origin, SRI requires crossorigin="anonymous" on the script element and a response from the script host that allows the request through Cross-Origin Resource Sharing (CORS). The public Novella widget URL currently omits the required CORS header. Adding SRI attributes to the standard snippet would therefore block the widget.

If your organization's security policy requires SRI, contact Novella Support before changing the snippet. Share the page URL and the scanner finding so we can advise on your installation.

Single-Page Applications

The widget detects navigation through history.pushState, history.replaceState, and browser back and forward navigation. It re-evaluates URL rules and records each distinct SPA URL once during the current page runtime.

If your application changes content without updating browser history, call refresh().

window.NovellaWebsiteWidget?.refresh();

Verify the Installation

  1. Open a page that matches an active widget's URL rules.
  2. In browser developer tools, confirm that novella.js loads successfully.
  3. Confirm that /api/widgets/config returns a successful response.
  4. If website analytics is enabled, confirm that /api/widgets/track returns a successful response.
  5. Open the feedback button and submit a test response.
  6. Verify the response and its page, campaign, and referrer context in Novella.

Test consent-controlled installations both before and after consent is granted.

Troubleshooting

The widget does not appear

  • Confirm data-workspace contains the correct public workspace key.
  • Confirm the widget is active and its URL rules match the complete page URL.
  • Check its dismissal, impression, and completion-frequency rules.
  • Confirm the current HTTPS hostname matches the primary domain configured in Novella or one of its subdomains.
  • Check the browser console for CSP errors blocking the script, API, or frame. If you added an integrity attribute, also check for integrity or CORS errors.

Configuration returns 403

The current origin is unauthorized for the workspace, or the workspace lacks a valid primary domain. Use HTTPS and verify the domain in Novella.

The button appears, but the survey does not open

Check whether frame-src permits https://surveys.novellahq.com. Widget frames use a dedicated, token-protected embed endpoint.

Pageviews are missing

  • Check whether the snippet sets data-analytics="false". Remove that attribute to enable website pageviews.
  • If data-autoload="false", confirm your consent callback calls load().
  • Check whether CSP, a browser extension, or a network privacy tool blocks /api/widgets/track.
  • Confirm the Tinybird website_events datasource and server-side ingestion credentials are configured.

Personalization is missing

Inspect the rendered script element in your browser to verify that your application or tag manager resolved the personalization placeholders. Novella discards empty, invalid, and unresolved values.

Updating or Removing the Widget

You can manage widget presentation, survey selection, triggers, URL rules, and frequency in Novella. These settings normally take effect without changing your snippet. To remove the widget and website analytics entirely, remove the script element from your site or tag manager.