How to Target a Survey Based on a Cookie Value
Qualaroo allows you to target visitors using browser cookies. You can enable or disable the survey for users based on whether their cookie value matches your targeting criteria.
Industrial Use Case
Suppose you run an e-commerce website and want to gather feedback from customers who have made a purchase.
You can set a cookie on the user’s browser when they complete a purchase and then use Qualaroo’s cookie targeting feature to only show a survey to users with that cookie.
This way, you can gather valuable feedback from customers who have completed a purchase on your website and use their insights to improve the shopping experience for future customers.
Using Qualaroo’s cookie targeting feature, you can display surveys to specific users based on their browser cookie values. This allows you to:
- Obtain high-quality responses from a targeted group of users.
- Gather feedback from returning customers.
- Show surveys to visitors who arrived via a particular referral link.
In this article, you will learn:
1. How to target a survey based on a cookie value
2. How to find cookies in your browser
3. How to prevent Qualaroo from showing survey for "X" days
How to Target a Survey Based on a Cookie Value
Step 1: In the TARGETING section, scroll down to Target: Advanced.
Step 2: Select the checkbox next to the “When specified cookies are present on the user’s browser” option.
Step 3: Enter the cookie parameter(name & value) in the text box.
Your survey will trigger when the cookies in the user's browser match the specified cookies.
1. You can add multiple cookies.
2. The cookie value is optional. The visitor will still see the survey if the specified cookie name matches the one on the browser.
Learn how to set cookies for survey answers.
When to use the “ANY” option
Visitors with at least one of the listed cookies on their browser will see the survey.
When to use the “All” option
Only visitors with all the listed cookies on their browsers will see the survey.
How to Find Cookies in Your Browser
In Chrome browser
Step 1: Open the targeted URL on which your survey is activated in the chrome browser.
Step 2: Press Cntrl+Shift+I to open the Dev tools. You can also click the right button on your mouse and click on Inspect.
Step 3: On the dashboard,
-
Click on Application
-
In the left sidebar, click on Cookies.
-
Copy the name & value and paste them into the cookie parameter field in the TARGETING Section.
In Firefox browser
Step 1: Open the targeted URL on which your survey is activated in your Firefox browser.
Step 2: Press Cntrl+Shift+I to open the Dev tools. You can also click the right button on your mouse and click on Inspect.
Step 3: On the dashboard,
-
Click on Storage.
-
In the left sidebar, click on Cookies.
-
Copy the name & value and paste them into the cookie parameter field in the TARGETING section.
In Safari browser
Step 1: Open the targeted URL on which your survey is activated in your Safari browser.
Step 2: Press Cntrl+Shift+I to open the Dev tools. You can also click the right button on your mouse and click on Inspect.
Step 3: On the Dashboard,
-
Click on Storage.
-
In the left sidebar, click on Cookies.
-
Copy the name & value and paste them into the cookie parameter field in the TARGETING section.
In Edge browser
Step 1: Open the targeted URL on which your survey is activated in your Edge browser.
Step 2: Press Cntrl+Shift+I to open the Dev tools. You can also click the right button on your mouse and click on Inspect.
Step 3: On the Dashboard,
-
Click on Application.
-
In the left sidebar, click on Cookies.
-
Copy the name & value and paste them into the cookie parameter field in the TARGETING section.
How to Prevent Qualaroo From Showing Survey for X Days
Using cookies, you can prevent Qualaroo surveys from being displayed to respondents for a specified period after they complete or dismiss them.
This helps to:
- Avoid repeated surveys that may annoy visitors.
- Ensure that survey data reflects changes over time.
- Increase the likelihood of receiving honest and thoughtful feedback.
So how do you do that?
To hide the survey for X days:
Step 1: Add the following JavaScript to your Qualaroo snippet:
;(function(){
window._kiq = window._kiq || [];
// Helper function to set cookie
function _setCookie(e,t,i){var o="";if(i){var n=new Date;n.setTime(n.getTime()+24*i*60*60*1e3),o="; expires="+n.toUTCString()}document.cookie=e+"="+(t||"")+o+"; path=/"};
// Tells Qualaroo to set a cookie called "__qual_seen" that expires in 30 days when the user sees any survey
window._kiq.push(['eventHandler', 'show', function(){
_setCookie('__qual_seen', '1', 30);
}]);
})();
</script>
For example, if you want to store the cookie only for 10 days, you can change the number of days for the last value passed to _setCookie as shown below::
Step 2: Go to the TARGETING section. Select the checkbox next to the option “When specified cookies are present on the user’s browser” in the Advanced targeting.
Step 3: Select “Do not display” and “ANY” in the targeting option. Then, enter the cookie “__qual_seen” in the text box.
Once done, click Save.
And that's it! If you encounter any issues or have any questions, don't hesitate to reach out to our support team.