Adding an Overlay Survey in Salesforce Communities

Add surveys to your Salesforce Communities and knowledge base to get feedback on your articles and resources. With a web overlay survey, you can add a button to take your survey on one or more pages of your Community. You can also track merge fields using the web overlay.

If you want to embed articles directly into a Community page and don’t need to track merge field data, use our free lightning component instead.

To set up your web overlay survey:

  1. From the survey builder, select Distribute > Website > Web Overlay.
  2. Customize your web overlay settings.
  3. Select Save.

Paste the Javascript snippet for your survey into your Community. You need to perform extra steps if you’re adding the survey to a private community (if people must log in to access your site).

  1. In, open your survey.
  2. From the survey builder, select Distribute > Website > Web Overlay.
  3. Scroll to the Install section and select Get snippet.
  4. Copy the Javascript snippet.
  1. In the Salesforce Community builder, select Settings > Advanced.
  2. Select Edit Head Markup.
  3. Paste the Javascript snippet at the bottom of the markup.

If users need to log in to access your site, you’ll need to add a few more code snippets to the head markup.

Add code to hide the survey by default:

Image of hiding survey overlay

Add code to create a Visualforce page that checks if the survey should be shown:

Image of show survey check

Be sure to replace User.Disable_Embedded_Surveys__c with the Salesforce field you'd like to use to either show or hide the survey.

You can create a Visualforce page with any custom code needed to attach merge fields or trigger the survey based on a field value.

For example, the block of code below specifies merge fields to to track with survey responses:

Image of tracking with merge fields script

Manage additional security settings to make sure your survey displays correctly. You’ll need to:

When you’re ready to turn on your survey:

  1. In, open your survey.
  2. Select Distribute > Website > Web Overlay.
  3. Under Enable, turn on the toggle.
  4. Under Appears On, choose where to display your survey, then enter your link.
  5. Select Save.