How to Use the API to Set Custom Property Matching
In Qualaroo, you can use the JavaScript API to set custom property matching to add a targeting condition that is specific to your website visitors.
Benefits of JavaScript API in setting the custom property:
-
Target relevant visitors for better response.
-
Customize your surveys with any targeting parameters.
How to Set the Custom Property Using the JavaScript API
Step 1: Add the additional javascript to your HTML code.
The above-mentioned javascript will display a survey only to users who made a purchase in the last 30 days and only when the shopping cart contains exactly 2 items.
Step 2: In the Advanced Targeting section:
-
Select the checkbox in front of the “When passed custom property is matched” option.
-
Enter the passed custom property in the required field.
The “num_items” and "whether the purchase has been made in the last 30 days" are custom targeting properties, where “2” and "yes" are their respective required targeting values.
Now you have specified the required values in the configuration UI, Qualaroo will compare the actual values with the required values. The survey will show up only if the values of all targeting parameters match their respective actual values.
Custom requirements are applied in addition to the standard ones. This allows you to target surveys based on standard requirements and custom properties specific to your business.
Any properties passed in a survey show up in the Individual Responses tab and in the CSV report.
Whatever passed custom property is used, names do not need to be single-word, camel-cased, or have any other specific formatting or syntax. Generally, it's best if they do not contain spaces ("customer_attribute" vs. "customer attribute"), and the name cannot contain hyphens.
You can set the values any number of times during the visit, on page load, or after the page loads. Every time you set a new value, Qualaroo will check again if a survey should be displayed.
And that's it! If you encounter any issues or have any questions, don't hesitate to reach out to our support team.