Cocos Analytics JavaScript SDK Access Documentation

SDK Download

JavaScript SDK supports WeChat mini games. You need to configure it in the backend of the WeChat mini program when using it.


  1. Log in to WeChat official platform as an administrator or developer:

  2. Select Development Settings in Settings and add the domain name information in Request Legal Domain Name.

  3. Domain name to be configured:

This domain name is used to obtain and accept statistical information. It is very important that you do not fill it in incorrectly.

Note: The legitimate domain name of the WeChat mini program can be modified up to 5 times a month.

After configuring the secure domain name, check the developer tools to ensure that the configuration takes effect.

Import Files

<script src=""></script>

TypeScript declaration file(.d.ts) cocosanalytics.d.ts


    appID: "8113",              // game ID
    version: "1.0.0",           // game/app version number
    storeID: "Apple Store",     // distribution channel
    engine: "cocos",            // game engine

Under special circumstances (some embedded browsers like mini programs), call onPause and onResume when switching between the front and back of the game, to accurately count the player's game duration data.


Local Debugging

//Enable (disable) local log output

results matching ""

    No results matching ""