Passer au contenu

Gestion des statistiques

Voici un exemple de code en JavaScript pour sauvegarder les statistiques du plugin

interface AppInfos {
version_name: string
action: 'delete' |
'reset' |
'set' |
'set_fail' |
'update_fail' |
'windows_path_fail' |
'canonical_path_fail' |
'directory_path_fail' |
'unzip_fail' |
'low_mem_fail' |
'download_fail' |
'update_fail' |
'download_10' |
'download_20' |
'download_30' |
'download_40' |
'download_50' |
'download_60' |
'download_70' |
'download_80' |
'download_90' |
'download_complete'
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 = JSONparse(eventbody || '{}') as AppInfos
const {
platform,
app_id,
action,
version_code,
version_os,
device_id,
version_name,
version_build,
plugin_version,
} = body
consolelog('update asked', platform,
app_id,
action,
version_os,
version_code,
device_id,
version_name,
version_build,
plugin_version)
// Sauvegardez-le dans votre base de données
return { status: 'ok' }
}

Ce point de terminaison doit retourner un JSON :

{ "status": "ok" }

Actions :

  • delete : quand un bundle est supprimé localement
  • reset : quand l’application revient au bundle intégré
  • set : quand l’application configure un nouveau bundle
  • set_fail : quand l’application ne trouve pas l’ID du bundle configuré
  • update_fail : envoyé après le délai et notifyAppReady n’a jamais été appelé
  • download_fail : quand le téléchargement n’est jamais terminé
  • download_complete: Quand le téléchargement se termine
  • download_xx: Envoyé tous les 10% du téléchargement ex : download_20, download_70
  • update_fail: quand le bundle ne parvient pas à exécuter notifyAppReady dans le délai imparti