This article steps through how Events can be used to trigger a survey to appear. Events let you trigger a survey based on a specific action on your site - useful when a URL alone isn't enough to define when the survey should appear.
Targeting surveys with Events
1. Ensure you've set up Events by implementing the Event API code on your site.
2. Create a new survey.
3. In the Target step, scroll to the Events section and select Select event.
4. Enter the event name in the Event field.
This is the name of the event that, when triggered on your site, will make the survey appear.
5. Click on 'Add event' if you would like to add another targeting rule. Only alphanumeric characters (a-z, A-Z, 0-9), underscores (_), and dashes (-) can be used in the event name.
6. Click 'Save' and ensure the status of your survey is 'Active'.
Your survey will appear when the event you've specified is present on a page.
When using events for Surveys, your behavior rules will still be followed. For example, you can set a survey to open after 10 seconds and use an event for targeting. In this case, the survey will appear 10 seconds after the event has been triggered (not 10 seconds after the page loaded).
Note:
URL and event targeting work independently. If both are set, the survey triggers as soon as either rule matches - so a URL match will show the survey on page load, before the event fires.
To trigger the survey only on an event:
- Go to the Target step.
- Under Pages, select All pages.
- Set your event under Events.
Events FAQs
Can I target events based on state changes?
Events were designed to allow Surveys to appear based on events that occur on a webpage. Targeting Events based on state changes rather than events on the page can cause inconsistent performance and is not advised.
How does event targeting work alongside URL targeting?
URL and event targeting work independently. If both are set, either rule can trigger the survey - so a URL match will show the survey on page load, even before the event fires. To trigger a survey only on an event, set Pages to All pages.
If multiple events are being fired on the same page, and the events are being used to target different surveys, the most recently fired event will be prioritized. This means that one event might trigger Survey A to appear, but then if a different event (targeting Survey B) is fired on the same page, it would trigger Survey B to appear (and cause Survey A to disappear) because Survey B was targeted by the most recently fired event.