All Collections
In-app Surveys
Code Customization
Showing a survey based on conditionals defined in your code
Showing a survey based on conditionals defined in your code

An example of setting up conditional triggers to exclude certain customer domains

Sarang Bhatt avatar
Written by Sarang Bhatt
Updated over a week ago

It is possible to trigger a survey only after certain conditions you've defined have been met. This is called conditional triggering.

Note: we offer codeless ways to manage this through our targeted sampling functionality, and encourage our customers to consider this path first as it simplifies installation and ongoing management of your surveys..

However, if you have specific ways you'd like to tightly control the survey visibility that might not be a great fit for targeted sampling, you can set conditions directly in the code. For example, if you'd like to exclude certain customer email domains from receiving a survey.  Here is an example code snippet that you can customize.

Some things to consider when setting conditions:

If you set the survey to appear immediately (using wootric_survey_immediately=true) after your conditions are met, you will bypass the survey sampling settings in the interface.  Any changes made to the sampling rules in the interface will not work.  You will have to apply any changes to sampling after the fact, directly to the code.  

Did this answer your question?