Quick Start

Let's use a game demo from Cocos Creator to quickly understand the statistical access process. If you haven't used Cocos Creator before, please refer to Cocos Creator's Development Documentation first.

Prepare Projects and Resourses

Configure Statistical Parameters

Open Cocos Creator, Click Menu Bar -> Panel -> Services, open Services

Set up Cocos AppID, refer to Cocos Service Panel Settings for details.

Then choose Cocos Analytics, enter Cocos Analytics service settings panel. Click the enable button in the upper right corner to enable the statistics service (If the statistics service has not been opened in the Cocos Account Center before, when the statistics service is enabled, a prompt box will be displayed as to whether to open the service, and you can follow the prompts.)

Once the service is enabled, you can see the new added Parameter Configuration, then you can fill in the parameters. The way to get parameters is as follows:

  • AppID: will automatically fill in the AppID of the currently bound game. Check this chapter Create Games for the method.

  • store: store is the game distribution channel ID. It can be arbitrarily set to ensure that it can be distinguished when obtaining statistical results. (length limit 200)

After the parameter configuration is complete, click Save, then open the Build Release panel, choose Android/iOS/Web platform for build compilation. The built release package has been automatically integrated with the Cocos Analytics service.

After the game is loaded, the statistics SDK will be initialized in the main.js file generated after the project is built, and the parameters set above will be passed in. If you need a batch release, you can also manually modify these parameters in main.js. After initialization, you can directly call the statistics SDK and send various statistics to the server.

Sample Project

You can click on the Sample Project in the Cocos Analytics service panel in Cocos Creator, or you can also download demo projects via the Cocos Analytics Demo.

  • Cocos Analytics does not support simulator libraries. If you need to export for testing on Android or iOS platform, please use real device debugging.

  • You can click all the buttons on the Sample, and click "Go to Console" in the Cocos Analytics service panel to refresh the page until the background refreshes the value. The data refresh cycle is about 10 minutes.

  • If all the data interfaces are debugged in the debugging state, the access is successful. You can click Finish Debugging above to switch to the normal mode.

For information about call interface, please refer to the Access Documentation section.

results matching ""

    No results matching ""