User Feedback Survey Pre-Segmentation

Target Feature Management rules based on how visitors interacted with a survey

Overview

User Feedback Survey pre-segmentation lets you target Feature Management (FM) rules at users based on their survey activity. For example, you can roll out a feature only to visitors who gave a low NPS score, or exclude visitors who already answered a feedback question.

In the dashboard, this condition type is labeled User Feedback Survey.

The Wingify SmartCode records survey activity in the browser.

Key features

Target users on the survey interaction events available in the dashboard (for example, question viewed, attempted, or submitted), and match on a specific answer to a question, or on any answer, when the event supports a response.

Prerequisites

  • The Wingify SmartCode is installed on the same page as the FM JavaScript SDK.
  • A User Feedback Survey is live on that page.
  • The SmartCode and the SDK run on the same origin.
  • User Feedback Survey pre-segmentation works only in the browser. It cannot run on server-side SDKs.

Enable User Feedback Survey pre-segmentation in FM

  1. In the dashboard, open the rule’s targeting and add a User Feedback Survey condition.

  2. Pick the survey, the question (if the event is question-scoped), and the event shown in the UI.

  3. If the event includes a response (for example, Answered/submitted), choose the answer to match, or choose any answer.

SDK Usage

Using the cookie as the user ID

const wingifyClient = await init({
  accountId: '123456',
  sdkKey: '32-alpha-numeric-sdk-key',
  isPulsePreSegmentEnabled: true,
});
 
// No user ID: for features with User Feedback Survey conditions,
// the SDK uses the _vwo_uuid cookie as the user ID.
const flag = await wingifyClient.getFlag('feature-key', {});
 
if (flag.isEnabled()) {
  // Show the feature.
}

Passing the cookie value yourself

You can also pass the cookie value yourself. The result is the same when it matches _vwo_uuid:

const wingifyClient = await init({
  accountId: '123456',
  sdkKey: '32-alpha-numeric-sdk-key',
  isPulsePreSegmentEnabled: true,
});
 
const visitorId = /* read _vwo_uuid from document.cookie */;
const flag = await wingifyClient.getFlag('feature-key', { id: visitorId });
 
if (flag.isEnabled()) {
  // Show the feature.
}

trackEvent and setAttribute APIs

When isPulsePreSegmentEnabled is true, trackEvent and setAttribute can also adopt _vwo_uuid as context.id if you omit id. Unlike getFlag, this does not require the call to be tied to a feature with User Feedback Survey conditions—only the init flag.

// Cookie present, no id → SDK uses _vwo_uuid
await wingifyClient.trackEvent('purchase', {}, { value: 10 });
await wingifyClient.setAttribute({ plan: 'pro' }, {});

Survey matching itself still happens only during flag evaluation (getFlag), not inside trackEvent / setAttribute.

Options and fields

Option/fieldTypeRequiredDescription
isPulsePreSegmentEnabledBooleanYes, to use User Feedback Survey targetingPass true in init. Default is false.
context.id (on getFlag)StringNo, for features with User Feedback Survey conditionsLeave empty to use the _vwo_uuid cookie, or pass the _vwo_uuid value. Any other value makes User Feedback Survey conditions evaluate as not matched.
context.id (on trackEvent / setAttribute)StringNo, when isPulsePreSegmentEnabled is trueLeave empty to use _vwo_uuid if the cookie is present. If the flag is off, id is still required.

Flow

The following steps describe what happens when you call getFlag with isPulsePreSegmentEnabled set to true:

flowchart TD
  A[Call getFlag] --> B[Feature has a User Feedback survey condition?]
  B -->|No| C[Flag evaluated as usual]
  B -->|Yes| D{Context user matches the _vwo_uuid visitor?}
  D -->|No| E[Survey condition does not match. Flag returned]
  D -->|Yes| F[Check displayed, attempted, or submitted. Flag returned]

How the visitor is identified

Survey activity belongs to the SmartCode visitor identified by the _vwo_uuid cookie. Before evaluating User Feedback Survey conditions, the SDK makes sure the FE user is that same visitor.

getFlag

This table applies when isPulsePreSegmentEnabled is true and the feature uses User Feedback Survey conditions:

_vwo_uuid cookiecontext.idWhat the SDK does
PresentNot passedUses the cookie value as the user ID and evaluates User Feedback Survey conditions.
PresentSame value as the cookieEvaluates User Feedback Survey conditions.
PresentAny other valueUser Feedback Survey conditions don’t match. Evaluation still uses your id.
MissingPassedUser Feedback Survey conditions don’t match.
MissingNot passedgetFlag fails because there is no user ID, and returns a disabled flag.

When the SDK uses the cookie value as the user ID, it uses it for everything in that getFlag call: bucketing, user storage, and the events sent to Wingify.

📘

Note

On getFlag, the cookie is used as the user ID only for features that use User Feedback Survey conditions. For any other feature, or when isPulsePreSegmentEnabled is false, getFlag still requires context.id.

trackEvent and setAttribute

This table applies when isPulsePreSegmentEnabled is true (no per-feature check):

_vwo_uuid cookiecontext.idWhat the SDK does
PresentNot passedUses the cookie value as id (and the matching web uuid) and continues.
PresentSame value as the cookieContinues with your id.
PresentAny other valueLogs a mismatch; still uses your id and continues.
MissingPassedContinues with your id.
MissingNot passedInvalid context; the call does not proceed.

When isPulsePreSegmentEnabled is false or omitted, context.id remains required for both APIs.

Events you can target

Use the event options shown in the dashboard for User Feedback Survey (for example, viewed, attempted, answered/submitted).

  • Presence-style events (such as viewed or attempted) match whether the interaction happened.
  • Answer-style events (such as answeredsubmitted) can match a specific response or any response.

Points to note

Note

  • Works only with the JavaScript SDK in the browser.

  • SmartCode and the FM SDK must share the same origin so _vwo_uuid , and survey event history in localStorage are available.

  • There is no server-side evaluation of User Feedback Survey conditions in the Node SDK


Did this page help you?