Home Reference Source
import {ShapezGameAnalytics} from 'shapez.io/js/platform/browser/game_analytics.js'
public class | source

ShapezGameAnalytics

Extends:

GameAnalyticsInterface → ShapezGameAnalytics

Member Summary

Public Members
public get
public

syncKey: *

Method Summary

Public Methods
public

generateGameDump(root: GameRoot): {"shapes": *, "upgrades": *, "belts": *, "buildings": *}

Generates a game dump

public
public
public

Handles the given level completed

public

Handles the given upgrade completed

public

initialize(): Promise<void>

public

Returns true if the shape is interesting

public

sendGameEvent(category: string, value: string)

Sends a game event to the analytics

public
public

sendToApi(endpoint: string, data: object): Promise<any>

Sends a request to the api

Inherited Summary

From class GameAnalyticsInterface
public

app: import("../application").Application

public

Handles a resumed game

public

Handles a new game which was started

public

Handles the given level completed

public

Handles the given upgrade completed

public

initialize(): Promise<void>

Initializes the analytics

Public Members

public get environment: string source

public syncKey: * source

Public Methods

public generateGameDump(root: GameRoot): {"shapes": *, "upgrades": *, "belts": *, "buildings": *} source

Generates a game dump

Params:

NameTypeAttributeDescription
root GameRoot

Return:

{"shapes": *, "upgrades": *, "belts": *, "buildings": *}

public handleGameResumed() source

Handles a resumed game

Override:

GameAnalyticsInterface#handleGameResumed

public handleGameStarted() source

Handles a new game which was started

Override:

GameAnalyticsInterface#handleGameStarted

public handleLevelCompleted(level: number) source

Handles the given level completed

Override:

GameAnalyticsInterface#handleLevelCompleted

Params:

NameTypeAttributeDescription
level number

public handleUpgradeUnlocked(id: string, level: number) source

Handles the given upgrade completed

Override:

GameAnalyticsInterface#handleUpgradeUnlocked

Params:

NameTypeAttributeDescription
id string
level number

public initialize(): Promise<void> source

Initializes the analytics

Override:

GameAnalyticsInterface#initialize

Return:

Promise<void>

public isInterestingShape(root: GameRoot, key: string): boolean source

Returns true if the shape is interesting

Params:

NameTypeAttributeDescription
root GameRoot
key string

Return:

boolean

public sendGameEvent(category: string, value: string) source

Sends a game event to the analytics

Params:

NameTypeAttributeDescription
category string
value string

public sendTimePoints() source

public sendToApi(endpoint: string, data: object): Promise<any> source

Sends a request to the api

Params:

NameTypeAttributeDescription
endpoint string

Endpoint without base url

data object

payload

Return:

Promise<any>