Skip to main content
All CollectionsTaking Feedback on WebGetting Started
Installing Website Surveys using JS Client Code
Installing Website Surveys using JS Client Code

Learn how to install JS Client Code to your Website or In-App or In-Product to display and trigger Zonka Feedback Surveys. ๐Ÿ–ฅ๏ธ

Sonika Mehta avatar
Written by Sonika Mehta
Updated over a year ago

To display and trigger Zonka Feedback Surveys and Forms on your Website, or within your app or product, you need to install the Zonka Feedback JS Client Code (a JavaScript code) to your website (or in-app).

Important things about the Zonka Feedback Web Client

Workspace-based Web Client

  • Each Workspace will have it's own JS Client Code to be installed on your Website or within your app.

  • Every survey in the Workspace and every widget (like Side Tab, Popup) in a survey will appear or be triggered using the same JS Client Code.

  • If you create a new widget or a new survey within a workspace, and you already have the code installed in your website, you don't need to re-install the code.

Running Multiple Surveys with Web Client

  • You can add multiple web surveys on your website by adding the common JS Client code snippet in your targeted web pages.

  • This common code will handle the target and behaviour of each widget as it has been set up.

Identifying Users

In addition to launching survey widgets, the JS Client can also be used to identify users and pass user properties. Learn more about it below.


In this article

Get the JS Client Code Snippet

  • Navigate to 'Settings'

  • In the Settings menu, go to 'Developers' section from the left navigation

  • In Developers, click on 'Install JS Client Code' or go here

  • Choose the Workspace for which you'd like to view the code


Installing JS Client Code directly on your Website or In-App

  • From the Install Web Client section, choose the Workspace for which you'd like to get the JavaScript Code Snippet for.

  • Once you've got the code, all you need to do is copy the code and paste it in the HTML of your Website or within your app.

  • Place this code after the <head> tag or before the </head> tag in your HTML.

  • Save and publish your changes to get the surveys working.


Identifying your Users

While you can take surveys and feedback without capturing any information about the respondents, we recommend you identify them whenever possible.

Identifying your Users allows you to link your Survey Responses to your customers, visitors or users of your product or app. For example, if you're running an eCommerce Website and are taking feedback after a purchase is completed, identifying a respondent can help you connect and link the survey response and satisfaction to the shopper on your website and the items they purchased.

Identifying Users also allows you to better segment and target the user and sync the responses to other tools and systems you use.

When you're copying the code from the Install JS Client Code section, you can choose from Anonymous Mode or Identify User. The following code block is responsible for identifying your users. When using the Identify User code, make sure that you replace the static code values with dynamic user data.

_zf('variables', {  
contact_email: "abc@somecompany.com", // Replace with User Email
contact_name: "Robert Hopkins", // Replace with User Name
})


Passing Other Variables to your Web Surveys

In addition to identifying the users, you can also pass other variables (Contact Variables, Survey Variables or Hidden Variables) in the code like country, subscription plan, user ID and more.

_zf('variables', {  
contact_email: "abc@somecompany.com", // Replace with User Email
contact_name: "Robert Hopkins", // Replace with User Name
subscription_plan: "Professional",
subscribed_date: "August 1, 2022",
country: "United States",
gender: "Male"
})

Passing variables in Web Surveys enriches your responses and reports, and these variables are available as filters in the platform.


Running Surveys in Anonymous Mode

There are many situations when you cannot or don't want to identify the users who are giving feedback and filling surveys. For instance, if you're taking Website Experience Feedback for visitors, you may not want to know the visitor details and the visitors may not be comfortable sharing the same. For such scenarios, you can run your surveys in Anonymous Mode.

Anonymous Mode means no personal identifiable information about your users, respondents, customers will be shared with Zonka Feedback. Once the respondent fills out the survey, their response will be available in Zonka Feedback without any identifiable information like email address, phone number, name.

You can switch between the Anonymous Mode and the Identify User mode in the bottom of the code. When using Anonymous Mode, identifyUser call from the code snippet will get removed.


What's next?

Once you've installed the JS Client Code on your Website or within your app, you will start getting feedback and responses. Here's what you can explore next.

Did this answer your question?