Version: 5.6
Eventos Personalizados
El Scripting de Custom Event (Eventos Personalizados)

Componente Analytics Tracker

The Analytics API automatically sends events to the Analytics Service under certain circumstances. However, custom events can also be sent using user-defined triggers. These can be configured and implemented entirely in the Editor as well as from script.

Attach an Analytics Tracker component to any GameObject to send a custom event via the Analytics API.

Analytics Tracker Component
Analytics Tracker Component
Propiedad: Función:
Event Name Set a name for the custom event.
Trigger Specify the immediate cause of the event being sent. See notes on Triggers below for more information.
Parameters Set a list of keys/values. Parameter data can be either static, where you specify set strings to send as the parameter data, or it can be arbitrary fields of arbitrary components attached to a provided GameObject. See notes on Parameters below for more information.

Triggers

The Trigger specifies the immediate cause of the event being sent.

Anayltics Tracker Trigger
Anayltics Tracker Trigger

External events

An event can leverage most standard methods in the MonoBehaviour life cycle, but it can also be triggered from an external source. For example, the External event trigger can be tied (entirely through the Editor) to a UI Button component’s click event:

Analytics Tracker External Events
Analytics Tracker External Events

In this example, a GameObject called MyAnalyticsTracker has an Analytics Tracker component with its Trigger type set to External. This button component can trigger the event by invoking AnalyticsTracker.TriggerEvent in its OnClick event.

Parameters

Use this field to set a list of keys/values. Parameter data can be either static, where you specify set strings to send as the parameter data, or arbitrary fields of arbitrary components attached to a provided GameObject.

Static parameters

Static Parameters
Static Parameters

Here, the parameter is marked as Static. In this example, the key is named “name” and the value is named “value”. You can change these to whatever you like. The data sent with the event for this parameter will always be the same.

Non-static parameters

Non-Static Parameters
Non-Static Parameters

This image shows a list of parameters registered as event data. The value is set to the boolParameter field of the user-defined class TestAnalyticsDataObject, and attached to a GameObject named ExampleGameObject. The event contains the contents of this field at the time when the event is sent. This could be set to any public field that resolves to a string, number or boolean.

Eventos Personalizados
El Scripting de Custom Event (Eventos Personalizados)