- Introduction
- Getting Started
- Installation
- Configuration
- Environment Requirements
- Operation Result
- License
HmsAnalyticsKitDemo provides an example of integrating Analytics Kit into a WeChat mini-program. It illustrates how to collect predefined events and custom events to improve user engagement and user preference. Learn more about Analytics Kit.
For details, please refer to the links below:
HmsAnalyticsKitDemo is used as an example to describe how to use the Analytics SDK for WeChat mini-programs.
First, download HmsAnalyticsKitDemo by cloning this repository or downloading the compressed package.
In the WeChat DevTools, click Import Project and select HmsAnalyticsKitDemo.
You can click Compile to run the project.
Create an app in AppGallery Connect, obtain the agconnect-services.json file, and assign the JSON data in it to the agconnectConfig variable in the HiAnalyticsConfig.js file. Click here to learn more.
- Use the WeChat DevTools to open the decompressed project. Two demos are provided:
- miniprogram.hmsanalyticskitdemo: demo that has integrated the SDK.
- miniprogram.hmsanalyticskitdemo-start: demo that has not integrated the SDK. You can use this demo to learn how to integrate the SDK.
- Enable the npm function. Click here to view the details.
- Run the following command to install the dependency:
npm install --save @hmscore/analytics-sdk-miniprogram
- Go to Tools > Build npm to build the dependency of the npm library.
- Create an app in AppGallery Connect and obtain the app configuration file agconnect-services.json. In the WeChat DevTools, assign the JSON data in the agconnect-services.json file to the agconnectConfig variable in the HiAnalyticsConfig.js file.
Hardware:
- A computer (desktop or laptop)
- A test phone with WeChat installed, used for previewing and debugging the mini-program
Software:
- Analytics Kit 6.3.0
- WeChat DevTools
- Node.js
After running the app, you will see the following screen.
Tap TRUE or FALSE to answer the question; tap NEXT to go to the next question; tap POST SCORE to record the obtained score. All information will be uploaded to the console of Analytics Kit. You can use DebugView to view the information in real time.
Tap SETTINGS, and you will see the following screen.
On the screen displayed, you can set your favorite sport. Your configuration will be recorded in the Analytics SDK as a user attribute.
HmsAnalyticsKitDemo is licensed under Apache 2.0.