Targeting a survey once per user

This article explains how to target any given website survey only once per user. Please be sure to read through our Javascript documentation beforehand.

This guide is based on the event "survey_seen". However, it can well be used with events such as "question_answered" or "survey_completed" - depending on what is it that you're trying to achieve.

In order to make sure that a website survey is only displayed once to a single user, follow these steps:

1. Passing attributes to Survicate

For more information on how to pass custom respondent attributes, please visit this article.

a) Identify a respondent and add an attribute such as "survey_seen":

<script type="text/javascript">
(function(opts) {
opts.traits = {
"survey_seen": user.seensurvey
})(window._sva = window._sva || {});
user.surveyseen should be replaced with the relevant value - preferably a boolean one.

b) The attribute "survey_seen" needs to be stored in your database as a user attribute so as to ensure consistency and make sure the attribute is not platform-dependent.

2. Targeting the survey

a) Set up targeting based on attributes. When editing a survey, click on Settings (1), then head over to Who should see your survey? (2) and click on Create new segment (3).

b) When creating a new segment, click on How do they use your website?. Tick the box which says They have custom attribute.

3) Attribute name should be survey_seen, attribute value should say false

By doing so, you'll make sure to target only those of your users who have not seen the survey.

3. Setting up the function to update user profiles

a) You need to set up EventListener to check when a user has answered a survey. When they do, you should change the survey_seen flag to true.

_sva.addEventListener('survey_displayed', function(surveyId) {
if (surveyId == "65f93ff602c63b57") { // change survey id to that of your survey
// here you should update the user attribute in your database to "true"

💬 If you need our assistance, please reach out to us at 

Do you find this helpful?

Powered by HelpDocs