Analytics: Yes2SDK.analytics

← Back to overview

Track gameplay events. All methods are synchronous, fire-and-forget.

Good to know: Custom events (logEvent, logScore, logTutorial, logPurchase) are recorded locally on every platform. Bring your own analytics pipeline if you need delivery. Exception (Yandex): when a Metrica counter ID is configured for the game (dashboard game settings), these events are additionally delivered to Yandex Metrica as reachGoal calls (see the Yandex quickstart). The gameplay lifecycle is wired to each platform's real engagement signals: logLevelStart/logLevelEnd drive gameplayStart/gameplayStop, which platforms use for monetization timing.


Methods (Core)

SignatureDescription
logEvent(eventName: string, valueToSum?: number, parameters?: AnalyticsParameters): voidCustom event. eventName must be non-empty.
logLevelStart(level: string): voidLevel start. Drives gameplayStart where supported.
logLevelEnd(level: string, score?: number, success?: boolean, durationSeconds?: number): voidLevel end. Drives gameplayStop where supported.
logScore(score: number, level?: string): voidScore event.
logTutorial(step: string, completed: boolean): voidTutorial event. step must be non-empty.
logPurchase(productId: string, price: number, currency: string): voidPurchase event. productId/currency non-empty.
logTutorialStart(): voidAlias → logTutorial("tutorial_start", false).
logTutorialEnd(): voidAlias → logTutorial("tutorial_end", true).
isSupported(): booleanWhether analytics is supported (true, covers gameplay tracking).

AnalyticsParameters = Record<string, string | number | boolean>


Platform support

MethodPokiGameDistributionCrazyGamesYandexYouTube
logEventNone¹None¹None¹Metrica⁵None¹
logLevelStartPartial²Partial³Partial²Partial²˒⁵None⁴
logLevelEndPartial²Partial³Partial²Partial²˒⁵None⁴
logScoreNone¹None¹None¹Metrica⁵None¹
logTutorialNone¹None¹None¹Metrica⁵None¹
logPurchaseNone¹None¹None¹Metrica⁵None¹
isSupportedReadyReadyReadyReadyReady

¹ Logged locally (logger.debug) only: no platform delivery. ² Logs locally and calls the real gameplayStart/gameplayStop (PokiSDK, CrazyGames sdk.game, Yandex GameplayAPI). ³ GameDistribution drives internal gameplay state only (no platform gameplay call). ⁴ YouTube sets an internal gameplay flag only. Note: the YouTube strategy additionally exposes real reportError/reportWarning backed by ytgame.health.logError/logWarning (not part of the cross-platform analytics surface). ⁵ Yandex only, when a Metrica counter ID is configured for the game: the call also fires ym('reachGoal', …). Goal name is the eventName for logEvent; score / tutorial / purchase / level_start / level_end for the typed methods. Without a counter configured it degrades to local logging (¹). Metrica is separate from the YaGames SDK. The dashboard injects the counter tag into Yandex builds. See the Yandex quickstart.


Unity (C#)

Yes2SDK.Analytics (Yes2SDKAnalytics).

SignatureDescription
void LogEvent(string name, Dictionary<string, object> parameters = null)Custom event.
void LogLevelStart(string level)Level start (Poki → gameplayStart()).
void LogLevelEnd(string level, int score, bool success, float durationSeconds = -1f)Level end. Negative duration = omitted.
void LogScore(int score, string level = "")
void LogTutorialStart()
void LogTutorialEnd()
void LogPurchase(string productId, float price, string currency)

Defold (Lua)

SignatureDescription
yes2sdk.analytics_log_level_start(level)
yes2sdk.analytics_log_level_end(level, score, success, duration_seconds)duration_seconds optional (nil/negative → omitted).
yes2sdk.analytics_log_score(score, level)
yes2sdk.analytics_log_tutorial_start()
yes2sdk.analytics_log_tutorial_end()
yes2sdk.analytics_log_game_choice(decision, choice)Logs a game_choice custom event {decision, choice}.
Pitch your game