Reference API Roblox

Engine API

Website

Related

Reference API Roblox

AnalyticsService

Collection of methods that allows developers to track how users interact with their experiences.

This class is not replicated. Its interface does not cross the network boundary.
This class is not creatable. Instances of this class cannot be created with Instance.new.
This class is a service. It is a singleton that may be acquired with GetService.
Tags: [NotCreatable, Service, NotReplicated]

Member index 14

HistoryMember
486ApiKey: string
619FireCustomEvent(player: Instance, eventCategory: string, customData: Variant): null
573FireEvent(category: string, value: Variant): null
619FireInGameEconomyEvent(player: Instance, itemName: string, economyAction: AnalyticsEconomyAction, itemCategory: string, amount: int, currency: string, location: Variant, customData: Variant): null
619FireLogEvent(player: Instance, logLevel: AnalyticsLogLevel, message: string, debugInfo: Variant, customData: Variant): null
619FirePlayerProgressionEvent(player: Instance, category: string, progressionStatus: AnalyticsProgressionStatus, location: Variant, statistics: Variant, customData: Variant): null
637LogCustomEvent(player: Player, eventName: string, value: double = 1, customFields: Dictionary = nil): null
623LogEconomyEvent(player: Player, flowType: AnalyticsEconomyFlowType, currencyType: string, amount: float, endingBalance: float, transactionType: string, itemSku: string = , customFields: Dictionary = nil): null
632LogFunnelStepEvent(player: Player, funnelName: string, funnelSessionId: string = , step: int = 1, stepName: string = , customFields: Dictionary = nil): null
622LogOnboardingFunnelStepEvent(player: Player, step: int, stepName: string = , customFields: Dictionary = nil): null
622LogProgressionCompleteEvent(player: Player, progressionPathName: string, level: int, levelName: string = , customFields: Dictionary = nil): null
622LogProgressionEvent(player: Player, progressionPathName: string, status: AnalyticsProgressionType, level: int, levelName: string = , customFields: Dictionary = nil): null
622LogProgressionFailEvent(player: Player, progressionPathName: string, level: int, levelName: string = , customFields: Dictionary = nil): null
622LogProgressionStartEvent(player: Player, progressionPathName: string, level: int, levelName: string = , customFields: Dictionary = nil): null
inherited from Instance
553Archivable: bool
635Capabilities: SecurityCapabilities
553Name: string
553Parent: Instance
635Sandboxed: bool
616UniqueId: UniqueId
576AddTag(tag: string): null
573ClearAllChildren(): null
462Clone(): Instance
573Destroy(): null
486FindFirstAncestor(name: string): Instance
486FindFirstAncestorOfClass(className: string): Instance
486FindFirstAncestorWhichIsA(className: string): Instance
486FindFirstChild(name: string, recursive: bool = false): Instance
486FindFirstChildOfClass(className: string): Instance
486FindFirstChildWhichIsA(className: string, recursive: bool = false): Instance
486FindFirstDescendant(name: string): Instance
563GetActor(): Actor
486GetAttribute(attribute: string): Variant
462GetAttributeChangedSignal(attribute: string): RBXScriptSignal
631GetAttributes(): Dictionary
648GetChildren(): Instances
462GetDebugId(scopeLength: int = 4): string
486GetDescendants(): Array
486GetFullName(): string
641GetStyled(name: string): Variant
576GetTags(): Array
576HasTag(tag: string): bool
486IsAncestorOf(descendant: Instance): bool
486IsDescendantOf(ancestor: Instance): bool
580IsPropertyModified(name: string): bool
573Remove(): null
576RemoveTag(tag: string): null
580ResetPropertyToDefault(name: string): null
573SetAttribute(attribute: string, value: Variant): null
462WaitForChild(childName: string, timeOut: double): Instance
648children(): Instances
553clone(): Instance
573destroy(): null
553findFirstChild(name: string, recursive: bool = false): Instance
648getChildren(): Instances
553isDescendantOf(ancestor: Instance): bool
573remove(): null
462AncestryChanged(child: Instance, parent: Instance)
462AttributeChanged(attribute: string)
462ChildAdded(child: Instance)
462ChildRemoved(child: Instance)
462DescendantAdded(descendant: Instance)
462DescendantRemoving(descendant: Instance)
500Destroying()
553childAdded(child: Instance)
inherited from Object
647ClassName: string
647className: string
647GetPropertyChangedSignal(property: string): RBXScriptSignal
647IsA(className: string): bool
650isA(className: string): bool
647Changed(property: string)

Removed member index 13

HistoryMember
386GetClientId(): string
386GetSessionId(): string
386ReleaseRBXEventStream(target: string): void
386ReportCounter(counterName: string, amount: int = 1): void
386ReportInfluxSeries(seriesName: string, points: Dictionary, throttlingPercentage: int): void
386ReportStats(category: string, value: float): void
386SendEventDeferred(target: string, eventContext: string, eventName: string, additionalArgs: Dictionary): void
386SendEventImmediately(target: string, eventContext: string, eventName: string, additionalArgs: Dictionary): void
386SetRBXEvent(target: string, eventContext: string, eventName: string, additionalArgs: Dictionary): void
386SetRBXEventStream(target: string, eventContext: string, eventName: string, additionalArgs: Dictionary): void
386TrackEvent(category: string, action: string, label: string, value: int64 = 0): void
386TrackEventWithArgs(category: string, action: string, label: string, args: Dictionary, value: int64 = 0): void
386UpdateHeartbeatObject(args: Dictionary): void

Description

AnalyticsService is a collection of methods that allows developers to track how users interact with their experiences, specifically player progression, in-experience economy, funnels, and custom events.

History 63

Members 14

ApiKey

TypeDefault
string

The ApiKey property contains the game's PlayFab API key. It must be set and valid in order to use FireEvent. It can be set by pasting and editing the following line of code into the Command bar:

1
game:GetService("AnalyticsService").ApiKey = "API_KEY"
This property is deprecated. It exists only for backward compatibility, and should not be used for new work.

History 4

Tags: [Deprecated]

FireCustomEvent

Parameters (3)
playerInstance
eventCategorystring
customDataVariant
Returns (1)
null

This function triggers a custom event with a custom event name data.

Limits of events

Each game server is allowed a certain number of standard events API calls based on the number of players present (more players means more events will be needed). The events that exceed the limit will be dropped and log an error to the developer console. - Per minute limit: 120 + numPlayers * 20, all events shared this limit. - Cooldown: refresh every 10 seconds

Limits of parameters

Limit the size of parameters. The event that exceeds the limit will be dropped and log an error to the developer console.

ParametersMaximum Number of Characters
customData Variant500 after serialized
other string types50

See also:

This function is deprecated. It exists only for backward compatibility, and should not be used for new work.

History 4

Tags: [Deprecated]

FireEvent

Parameters (2)
categorystring
valueVariant
Returns (1)
null

FireEvent reports a custom event to PlayFab. The event is reported using a category and value, where the category is a string and the value can be a string or table. In order to use PlayFab, you must have a valid ApiKey set.

Possible Errors

  • "AnalyticsService can only be executed by game server." – Tracking can only be done on the server through a Script or ModuleScript required by a script. See RunService:IsServer().
  • "The ApiKey is invalid." – The ApiKey has been set, but it's invalid. Check that it is set to the correct value.
  • "AnalyticsService can only accept valid UTF-8 characters." – Thrown when the value can't be serialized as UTF-8 characters. This can happen if you pass a value which has unicode characters, like emojis.
  • "AnalyticsService failed in parse event value. Error: ..." – Thrown when there is an issue when serializing the provided value into a string.
  • "AnalyticsService: , " and \r\n are not allowed in category." – The comma ,, the double quote ", and newline characters \r\n cannot be used in the category parameter.
  • "AnalyticsService: The event value you fired is too long." – Thrown if the value parameter was too long after serialization. The length limit is 1 KB, or 1024 bytes.
This function is deprecated. It exists only for backward compatibility, and should not be used for new work.

History 4

Tags: [Deprecated]

FireInGameEconomyEvent

Parameters (8)
playerInstance
itemNamestring
economyActionAnalyticsEconomyAction
itemCategorystring
amountint
currencystring
locationVariant
customDataVariant
Returns (1)
null

This function triggers an event used to track player actions pertaining to the in-game economy.

For example, it should be called to track when players acquire or spend virtual items within the economy like currency.

Limits of events

Each game server is allowed a certain number of standard events API calls based on the number of players present (more players means more events will be needed). The events that exceed the limit will be dropped and log an error to the developer console. - Per minute limit: 120 + numPlayers * 20, all events shared this limit. - Cooldown: refresh every 10 seconds

Limits of parameters

Limit the size of parameters. The event that exceeds the limit will be dropped and log an error to the developer console.

ParametersMaximum Number of Characters
customData Variant500 after serialized
other string types50

See also:

This function is deprecated. It exists only for backward compatibility, and should not be used for new work.

History 4

Tags: [Deprecated]

FireLogEvent

Parameters (5)
playerInstance
logLevelAnalyticsLogLevel
messagestring
debugInfoVariant
customDataVariant
Returns (1)
null

This function triggers an event used to track errors and warnings experienced by players.

For example, it could be called to indicate when a function call fails - such as a datastore save or TeleportService:Teleport(). See the example below.

Limits of events

Each game server is allowed a certain number of standard events API calls based on the number of players present (more players means more events will be needed). The events that exceed the limit will be dropped and log an error to the developer console. - Per minute limit: 120 + numPlayers * 20, all events shared this limit. - Cooldown: refresh every 10 seconds

Limits of parameters

Limit the size of parameters. The event that exceeds the limit will be dropped and log an error to the developer console.

ParametersMaximum Number of Characters
FireLogEvent stackTrace1000
FireLogEvent message500
customData Variant500 after serialized
other string types50

See also:

This function is deprecated. It exists only for backward compatibility, and should not be used for new work.

History 4

Tags: [Deprecated]

FirePlayerProgressionEvent

Parameters (6)
playerInstance
categorystring
progressionStatusAnalyticsProgressionStatus
locationVariant
statisticsVariant
customDataVariant
Returns (1)
null

This function triggers an event used to track player progression through the game.

For example, it should be called when a player starts an in-game tutorial and again that player finishes the tutorial. Another example (see below) includes tracking when a player gains experience, collects objects, and levels up.

Limits of events

Each game server is allowed a certain number of standard events API calls based on the number of players present (more players means more events will be needed). The events that exceed the limit will be dropped and log an error to the developer console. - Per minute limit: 120 + numPlayers * 20, all events shared this limit. - Cooldown: refresh every 10 seconds

Limits of parameters

Limit the size of parameters. The event that exceeds the limit will be dropped and log an error to the developer console.

ParametersMaximum Number of Characters
FirePlayerProgressionEvent location5 pairs of Key and Value, each Key and Value are 50
FirePlayerProgressionEvent statistics5 pairs of Key and Value, each Key and Value are 50
customData Variant500 after serialized
other string types50

See also:

This function is deprecated. It exists only for backward compatibility, and should not be used for new work.

History 4

Tags: [Deprecated]

LogCustomEvent

Parameters (4)Default
playerPlayer
eventNamestring
valuedouble1
customFieldsDictionarynil
Returns (1)
null

Logs an event used to track custom metrics of a user in experience. For additional information, see Custom Events.

History 1

LogEconomyEvent

Parameters (8)Default
playerPlayer
flowTypeAnalyticsEconomyFlowType
currencyTypestring
amountfloat
endingBalancefloat
transactionTypestring
itemSkustring
customFieldsDictionarynil
Returns (1)
null

Logs an event used to track player actions related in experience.

History 3

LogFunnelStepEvent

Parameters (6)Default
playerPlayer
funnelNamestring
funnelSessionIdstring
stepint1
stepNamestring
customFieldsDictionarynil
Returns (1)
null

Logs an event used to track user actions stepping through a pre-planned funnel. Funnel breakdowns will only consider the user and event values from the first step in a funnel session.

History 3

LogOnboardingFunnelStepEvent

Parameters (4)Default
playerPlayer
stepint
stepNamestring
customFieldsDictionarynil
Returns (1)
null

Logs an event used to track user actions stepping through an onboarding funnel. Funnel breakdowns will only consider the user and event values from the first step in a funnel session.

History 2

LogProgressionCompleteEvent

Parameters (5)Default
playerPlayer
progressionPathNamestring
levelint
levelNamestring
customFieldsDictionarynil
Returns (1)
null

Logs an event for when a user has completed a level attempt. This event does not currently display in any Roblox-provided charts.

History 2

LogProgressionEvent

Parameters (6)Default
playerPlayer
progressionPathNamestring
statusAnalyticsProgressionType
levelint
levelNamestring
customFieldsDictionarynil
Returns (1)
null

Logs an event for when a user has started, completed, or failed a level attempt. This event does not currently display in any Roblox-provided charts.

History 2

LogProgressionFailEvent

Parameters (5)Default
playerPlayer
progressionPathNamestring
levelint
levelNamestring
customFieldsDictionarynil
Returns (1)
null

Logs an event for when a user has failed a level attempt. This event does not currently display in any Roblox-provided charts.

History 2

LogProgressionStartEvent

Parameters (5)Default
playerPlayer
progressionPathNamestring
levelint
levelNamestring
customFieldsDictionarynil
Returns (1)
null

Logs an event for when a user has started a level attempt. This event does not currently display in any Roblox-provided charts.

History 2

Removed members 13

GetClientId

Parameters (0)
No parameters.
Returns (1)
string

History 2

GetSessionId

Parameters (0)
No parameters.
Returns (1)
string

History 2

ReleaseRBXEventStream

Parameters (1)
targetstring
Returns (1)
void

History 2

ReportCounter

Parameters (2)Default
counterNamestring
amountint1
Returns (1)
void

History 2

ReportInfluxSeries

Parameters (3)
seriesNamestring
pointsDictionary
throttlingPercentageint
Returns (1)
void

History 2

ReportStats

Parameters (2)
categorystring
valuefloat
Returns (1)
void

History 2

SendEventDeferred

Parameters (4)
targetstring
eventContextstring
eventNamestring
additionalArgsDictionary
Returns (1)
void

History 2

SendEventImmediately

Parameters (4)
targetstring
eventContextstring
eventNamestring
additionalArgsDictionary
Returns (1)
void

History 2

SetRBXEvent

Parameters (4)
targetstring
eventContextstring
eventNamestring
additionalArgsDictionary
Returns (1)
void

History 3

SetRBXEventStream

Parameters (4)
targetstring
eventContextstring
eventNamestring
additionalArgsDictionary
Returns (1)
void

History 2

TrackEvent

Parameters (4)Default
categorystring
actionstring
labelstring
valueint640
Returns (1)
void

History 3

TrackEventWithArgs

Parameters (5)Default
categorystring
actionstring
labelstring
argsDictionary
valueint640
Returns (1)
void

History 2

UpdateHeartbeatObject

Parameters (1)
argsDictionary
Returns (1)
void

History 2

Settings