Website or in-product surveys can be installed on your website in various methods, one of which is Google Tag Manager.
If you're using Google Tag Manager on your website, you can also use it to establish the surveys' Audience, to keep all your code in one place.
Targeting your survey based on respondent attributes lets you:
create Audiences to only collect feedback from chosen groups of visitors,
target surveys based on demographics, department, or type of company someone works in,
filter your surveys' answers for better respondent sampling and analysis.
In this article, we'll guide you step-by-step through using GTM to passing respondent attributes to Survicate, and using them to target the surveys.
Please note that this feature is available on some of our subscription plans. Reach out to us at support@survicate.com to learn more about the pricing.
Install Survicate on your website
We described how to add the Survicate tracking code via GTM to your website in this guide.
Please follow the steps outlined there, and then you'll be able to continue setting up respondent attributes.
Pass attributes through Google Tag Manager
To collect and use attributes, you need to paste an additional code right before the regular Survicate tracking code on your website.
To do this:
1. Open the HTML tag with the Survicate tracking code in Google Tag Manager.
2. In this tag, modify the code to include additional JavaScript, responsible for passing user attributes to Survicate.
Your attributes, in this form:
// Define attributes when initializing the tracking code
(function(opts) {
opts.traits = {
"user_id": "Your user ID here",
"company_name": "Value here",
"subscription_status": "Value here",
"signed_up": "Value here"
};
})(window._sva = window._sva || {});
/// Your tracking code goes here
should be included in the Survicate tracking code like this:
More information about the JavaScript methods can be found in our documentation for developers.
3. The GTM tag with the above code should be triggered in Google Tag Manager by any trigger of your choice, to initialize the Survicate code and show the survey:
Set up the Audience in your survey
1. Head over to the Target > Audience tab of your Website or in-product survey.
2. Click the New Audience button, give your audience a name, and click Create Audience.
Pick Attributes under the Add filter button:
3. Write in the Attribute name, select the Operator, and add Attribute value(s):
You can add up to 50 attributes to an Audience.
❗️The limit of how many attributes can be passed to one Survicate workspace for all survey types altogether is 2,000.
❗️ Attribute and attribute value names are case-sensitive. If there is any discrepancy between the name of the attribute you send to Survicate and the Survicate panel, the Audience will not work properly.
4. You are able to pick whether you'd like to include or exclude the visitors with a specific attribute:
5. Once you are ready with the audience you'd like to filter, click Create Audience and enable the chosen Audience to display the survey correctly:
💡 Learn more about the operators available in the Audience here.
Use multiple Audiences
1. If you have two or more filters in the same audience, you can decide if we should trigger the survey when all of these filters match the visitor (AND condition) or only one of them (OR condition).
2. If you have two or more audiences enabled, we trigger the surveys to all enabled audiences. The website visitor must match the requirements of at least one of the enabled Audiences (OR condition).
Filter results by respondent attributes
The respondent attributes passed via Google Tag Manager will also be included in the Analyze tab of the survey.
1. Go to the Analyze tab of your survey, click Filter, and you'll see your Custom attributes to filter responses with:
❗️The attribute will be available to choose a filter with after the survey receives at least one response with this attribute.
2. You can also see this attribute with its value in Analyze > Individual responses assigned to the respondent, next to their answers:
📞 If you have any questions about triggering a survey with Google Tag Manager, please reach out to us at support@survicate.com or strike up a chat conversation 👉