Skip to content
For the complete documentation index, see llms.txt. This page is also available as Markdown.

AnalyticsService

AnalyticsService : Instance

Overview

AnalyticsService is a service that logs what players do in a world as events so that the aggregated results can be checked in Creator Hub.

It logs the occurrence and value of a specific action with a Custom Event, and the tutorial progress of players with an Onboarding Funnel Event. Events are sent only from worlds published as public or private; in a Play Test in Studio, only the arguments passed are checked.

Get AnalyticsService with GetService(). This service works only in a server environment and cannot be called from a client script.

Properties

Methods

LogCustomEvent

Logs one Custom Event. It returns immediately without waiting for the result of the transmission.

An event logged without value and an event logged with a value of 0 are saved as different values. Up to 50 characters of eventName and each Custom Field value are saved, and anything beyond 50 characters is cut off before saving.

Parameters

Player player

The player who triggered the event.

string eventName

The name of the event. Up to 50 characters are saved, and passing an empty string causes an error.

number value

(Optional) A number logged with the event. Negative numbers and decimals can be used, but NaN and infinity cannot.

Dictionary customFields

(Optional) A breakdown table that uses the Name of an AnalyticsCustomFieldKeys item as the key and a string as the value. Up to 3 fields can be specified.

Return

void

Code Samples

LogOnboardingFunnelStepEvent

Logs that a player reached a step of the onboarding funnel. It returns immediately without waiting for the result of the transmission.

Even if the same player logs the same step multiple times, only the first time the step is reached is reflected in the step conversion. If a higher step is logged without logging the steps in between, the earlier steps are also counted as completed.

Parameters

Player player

The player who progressed through the step.

number step

The step number. Use a number from 1 to 100, with up to two decimal places. A value outside this range causes an error.

string stepName

(Optional) The step name shown in Creator Hub. Up to 50 characters are saved.

Dictionary customFields

(Optional) A breakdown table that uses the Name of an AnalyticsCustomFieldKeys item as the key and a string as the value. Up to 3 fields can be specified.

Return

void

Code Samples

Events

See also

Analytics

Last updated