Lewati ke konten

Stats endpoint

Konten ini belum tersedia dalam bahasa Anda.

Here is an example of code in JavaScript to save the stats of the plugin

interface AppInfos {
version_name: string
action: 'delete' |
'reset' |
'set' |
'get' |
'set_fail' |
'update_fail' |
'download_fail' |
'windows_path_fail' |
'canonical_path_fail' |
'directory_path_fail' |
'unzip_fail' |
'low_mem_fail' |
'update_fail' |
'download_10' |
'download_20' |
'download_30' |
'download_40' |
'download_50' |
'download_60' |
'download_70' |
'download_80' |
'download_90' |
'download_complete' |
'decrypt_fail' |
'app_moved_to_foreground' |
'app_moved_to_background'
version_build: string
version_code: string
version_os: string
plugin_version: string
platform: string
app_id: string
device_id: string
custom_id?: string
is_prod?: boolean
is_emulator?: boolean
}
export const handler: Handler = async (event) => {
const body = JSON.parse(event.body || '{}') as AppInfos
const {
platform,
app_id,
action,
version_code,
version_os,
device_id,
version_name,
version_build,
plugin_version,
} = body
console.log('update asked', platform,
app_id,
action,
version_os,
version_code,
device_id,
version_name,
version_build,
plugin_version)
// Save it in your database
return { status: 'ok' }
}

This endpoint should return a JSON:

{ "status": "ok" }

Actions:

  • delete : when a bundle is deleted locally
  • reset : when the app reset to the built-in bundle
  • set : when app sets a new bundle
  • set_fail : when app couldn’t find the ID of the bundle set
  • update_fail : send after the delay and notifyAppReady never called
  • download_fail : when download never finished
  • download_complete: When download finish
  • download_xx: Send every 10% of download ex : download_20, download_70
  • update_fail: when the bundle fails to do notifyAppReady in the timeframe