Gaze Events and Other Event Types
Gaze events allow triggering an action when an ad has been looked at. That is, when the centre of the user’s view has crossed the border of the creative inside the placement. We detect when the gaze has entered and left the creative using the following events:
PlacementsEvent.GazeStartEvent.OnGazeStart
- Triggered when a camera starts looking at the placement.PlacementsEvent.GazeEndEvent.OnGazeEnd
- Triggered when a camera stops looking at the placement.PlacementsEvent.ClickEvent.OnClick
- This is a gaze click, triggered when a camera looks at the placement for more than 3 seconds (note, this event is deprecated).PlacementsEvent.TouchClickEvent.OnTouchClick
- Triggered when a player has touched the banner. This feature works only if the placement has the touch click feature enabled.
Setting up placement events through the inspector
You can set up a gaze event object to control actions for all supported events in every individual Admix placement.
Defining actions for Admix SDK events through the SDK API
Gaze start event code example:
using Admix.AdmixCore.AdmixEvents;
using Admix.AdmixCore.AdmixPlacements;
public AdmixPlacementBase AdmixPlacementGameObject;
public class CodePlacementEvents : MonoBehaviour
{
private void Awake()
{
AdmixPlacementGameObject.PlacementsEvent.GazeStartEvent.OnGazeStart.AddListener(arg1 =>
{
DoSomething();
});
}
}
Gaze end event code example:
using Admix.AdmixCore.AdmixEvents;
using Admix.AdmixCore.AdmixPlacements;
public AdmixPlacementBase AdmixPlacementGameObject;
public class CodePlacementEvents : MonoBehaviour
{
private void Awake()
{
AdmixPlacementGameObject.PlacementsEvent.GazeEndEvent.OnGazeEnd.AddListener(arg1 =>
{
DoSomething();
});
}
}
Gaze click event code example:
using Admix.AdmixCore.AdmixEvents;
using Admix.AdmixCore.AdmixPlacements;
public AdmixPlacementBase AdmixPlacementGameObject;
public class CodePlacementEvents : MonoBehaviour
{
private void Awake()
{
AdmixPlacementGameObject.PlacementsEvent.ClickEvent.OnClick.AddListener(arg1 =>
{
DoSomething();
});
}
}
Gaze touch-click event code example:
using Admix.AdmixCore.AdmixEvents;
using Admix.AdmixCore.AdmixPlacements;
public AdmixPlacementBase AdmixPlacementGameObject;
public class CodePlacementEvents : MonoBehaviour
{
private void Awake()
{
AdmixPlacementGameObject.PlacementsEvent.TouchClickEvent.OnTouchClick.AddListener(arg1 =>
{
DoSomething();
});
}
}