Skip to content

Using ExitPoll

Overview

ExitPoll allows you to directly ask questions to your participants. This page will walk you through the process of enabling and configuring an ExitPoll in your application.

exitpoll screenshot

Displaying an ExitPoll

Create an ExitPoll Hook on your Dashboard as explained on the Dashboard Exitpoll page. You will need the Hook to display the ExitPoll in your experience. The hook will be your unique identifier to retrieve a set of questions from the backend.

Note

Ensure that SessionBegin() is called before an ExitPoll is activated. Otherwise it will not display properly.

ExitPoll Holder Component

Once you've setup your question set(s) on the dashboard, you need to add an ExitPollHolder component to your Unity scene to configure and display the questions. A screenshot of the component's inspector is provided below, followed by an explanation of the options available to you.

exitpoll component

  • Question Set Hook - Enter your question set hook here. It is required to retrieve the questions from the dashboard. You can find it on your Cognitive3D online dashboard.
  • Activate on Enable - Check this box if you want exitpoll to start as soon as this component is enabled. Otherwise you will need to call ExitPollHolder.Activate() yourself as shown in the example below.
public Cognitive3D.ExitPollHolder holder;
void SomeFunction()
{
 //display the ExitPoll
 holder.Activate();
}
  • ExitPoll Pointer Type - Select how your users will interact with the exit poll.

    • HMD Pointer - Users will be able to interact with buttons by focusing their hmd on them. We will display a red crosshair for the users' convenience.
    • Right Controller Pointer - Users will be able to interact with buttons by pointing and pulling the trigger on the right controller. In Meta applications, if hand tracking is available, users can also use buttons using their right hand and a pinch gesture.
    • Left Controller Pointer - Users will be able to interact with buttons by pointing and pulling the trigger on the left controller. In Meta applications, if hand tracking is available, users can also use buttons using their left hand and a pinch gesture.
  • Tracking Space - World or Player Relative. Configures the behaviour of how the ExitPoll panel will move.

    • (World Space) Attach Transform - Check this box if you want exit poll panels to follow this GameObject. Otherwise, the panels will stay in the absolute world spawn position.
    • (Player Space) Collision Layer Mask - The ExitPoll panel will try to spawn in front of the participant and avoid collisions with GameObjects on these layers.
    • (Player Space) Sticky Window - Check this box if you want the exit poll to stay relative to the user when they move/teleport.
    • (Player Space) Lock Y Position - Check this box if you want to match the ExitPoll panel with the vertical position of the participant's HMD
    • (Player Space) Default Display Distance - Sets the preferred distance away from the participant to spawn the ExitPoll panel
  • Panel Overrides - Allows you to display custom panels for this ExitPoll question set
  • On Begin - Events called when the ExitPoll is activated, has a valid question set, and displays a panel
  • On Complete - Events called when the question set is completed successfully
  • On Close - Events called when the question set closes for any reason including after OnComplete is called. If there is an error receiving questions this may be called instead of OnBegin

Prefab Overview

The ExitPoll panel prefabs are ready to use in any application. It was built to be flexible and easy to change to fit your user experience and functionality.

  • The ExitPoll panels use Unity's built in Canvas system
  • All the art is separated from the functioning part of this panel; replacing this with your assets is easy

panels

  • The buttons have a small radius that fills while the participant is looking at it
  • The On Look action is similar to Unity's Canvas buttons - they can invoke functions on other components. These are loosely connected so you can replace these buttons with your own button script

button

Customization

Using the ExitPoll Holder component outlined above is a simple way to override which prefabs to use for a single ExitPoll question set. Or you can change the default ExitPoll Panel prefabs located in the Cognitive3D Package in the Runtime/Resources folder. These are loaded by name in the ExitPoll class. The exit poll panel prefabs can now be downloaded as a sample in addition to the SDK - this will allow you to customize the prefabs and drag and drop them as panel overrides in the ExitPollHolder component.

Art

The visuals of each ExitPoll prefab are mostly separate from the functionality; the background, buttons, and text can be changed or removed as needed. In the case of the 'Scale' and 'Multiple Choice' Exitpoll types, all the buttons already exist in the prefab and are disabled as necessary.

Input system

The ControllerPointer component pointing at a VirtualButton component will call SetPointerFocus() each frame. The VirtualButton handles the visuals and delay before calling the OnConfirm action. This is implemented as a UnityEvent and can be set in the inspector. This calls the AnswerInt function on the ExitPollPanel component on the root GameObject with a property value.

A custom input must call AnswerInt similarly to these default buttons. For example, you could create a new script and use Unity's OnCollision method to call this UnityEvent, or hardcode the function call and pass the correct value as a parameter. Here is a very simple code sample:

//OnImpact is set to call 'AnswerInt' in the inspector
public UnityEngine.Events.UnityEvent OnImpact;
private void OnCollisionEnter(Collision c)
{
 if (c.gameObject.CompareTag("hand"))
  OnImpact.Invoke();
}

Offline Exitpoll

The ExitPoll Question Set will be saved locally if Local Data Cache is enabled. This can be changed in Preferences from the Cognitive3D menu. Fore more information on saving data locally, you can visit our docs on the local cache.

If the device cannot reach the internet it will display the last Question Set it received when there was an internet connection. Participant responses will be saved locally until the application connects to the internet.

intercom If you have a question or any feedback about our documentation please use the Intercom button (purple circle) in the lower right corner of any web page.