Installation

Installation overview

Survicate offers several installation methods to choose from, depending on your needs and preferences:

  • Manual JavaScript code installation
  • Survicate Web Package
  • Survicate Web Surveys Wrapper
  • Via Segment
  • Wordpress Plugin
  • Google Tag Manager Plugin

Manual implementation

By opting for Manual implementation or utilizing the Survicate Web Surveys Wrapper, you ensure automatic access to the latest SDK version. These methods negate the need for frequent updates whenever Survicate releases new SDK features.

NPM packages

Survicate offers two NPM packages for integrating surveys into your JavaScript applications: the Survicate Web Package, designed for embedding surveys directly within your code, and the Survicate Web Surveys Wrapper, optimized for easy installation of Survicate's tracking code in your codebase.

Comparison: Web Package vs. Web Surveys Wrapper

FeatureWeb PackageWeb Surveys Wrapper
Integration TypeDirect integration in JavaScript applicationsInstallation of Survicate tracking code
HTML Script AdditionDoes not add any script to the HTML documentAdds script to the HTML document
SecurityPrioritizes security, no external scripts required-
TypeScript SupportIncludes TypeScript type definitionsIncludes TypeScript type definitions
Version UpdatesManual updates for new SDK versionsAutomatically uses the latest Survicate SDK version
AvailabilityExclusive for enterprise plan subscribersAvailable for all users

Workspace Key

Workspace key is a unique identifier of your teamspace on Survicate account. It will be needed to complete the installation. Your workspace key can be obtained via your Survicate account here

Installation methods

Manual implementation

Place this code right before the </body> tag of your website or web app.

Information about the code being installed is sent to Survicate the moment your site is loaded with our code on it.

To verify installation on your own, you can use the _svc method in the browser console. It should return your Workspace Key.

NPM packages

This section applies only to users, who decided to install Survicate tracking code either via the npm web surveys package, or npm wrapper.

Installation

Initialization

Segment

Survicate can be installed with Segment. Follow these instructions, to add Survicate as a destination in Segment.

WordPress

Use our WordPress plugin to install Survicate on your WordPress website. Follow these instructions and use this workspace key during the installation.

Google Tag Manager

To install Survicate using Google Tag Manager, follow this article.

Content Security Policy (CSP)

Content Security Policy (CSP) serves as a safeguard against code injection attacks, where harmful content is executed within a trusted webpage. However, this security measure may interfere with the functionality of Survicate on your site. If you use CSP, you should update it with the following directives to ensure Survicate's surveys work effectively without compromising security:

Nonce

Survicate allows users to implement nonce as an additional security measure when embedding scripts. A nonce (number used once) helps mitigate certain types of attacks, such as Cross-Site Scripting (XSS), by ensuring that each script request is authorized.

How to implment nonce with different installation types

Identify users

Each time a user answers a Survicate survey they're assigned a unique, anonymous ID. For most companies it makes sense to have these responses identified. To do so, you can pass user IDs and attributes from your website or web app.

Here's a sample implementation:

User attributes

Survicate lets you also pass other attributes. Attributes provide deeper insight into collected feedback. You can use them to target the right audiences and filter survey results. Some example attributes that can be passed to Survicate are:

  • Company name
  • Subscription name
  • Signed up date

User attributes can be seen on their profile in the respondents tab.

Supported Attribute Types

  • String: Any textual data, e.g. company names, user name, etc.
  • Numbers: Includes integers and decimals, both positive and negative.
  • Boolean: True or false values.
  • Date: Accepts date objects created using Date() constructor: new Date('1995-12-17T03:24:00') or dates in ISO 8601 format (e.g., YYYY-MM-DDTHH:MM:SSZ).

Important to note:

  • The max length of a string is 255 characters.
  • Strings should not be enclosed within the following characters: , *, [], %, ~, --, $ (e.g., 'name':'$john$').
  • Attribute names are case sensitive.

To pass user attributes to Survicate and use them for survey targeting, you should define these attributes when initializing the Survicate. Please note that attribute names are case-sensitive, whereas attribute values are not.