Beginner: Integration of Huawei Analytics Kit in Andriod (Kotlin)

Murali Akula
7 min readMay 31, 2021

--

Introduction

In this article, we can learn about Integration of Analytics Kit in your Project. HUAWEI Analytics Kit provides analysis models to understand user behaviour and gain in-depth insights into users, products and content. It helps you to gain insight about user behaviour on different platforms based on the user behaviour events and user attributes reported by through apps.

Prerequisites

1. Must have a Huawei Developer Account.

2. Must have a Huawei phone with HMS 4.0.0.300 or later.

3. Must have a laptop or desktop with Android Studio, Jdk 1.8, SDK platform 26 and Gradle 4.6 installed.

Integration Preparations

1. First register as Huawei developer and complete identity verification in Huawei developers website, refer to register a Huawei ID.

2. Create a project in android studio, refer Creating an Android Studio Project.

3. Generate a SHA-256 certificate fingerprint.

4. To generate SHA-256 certificate fingerprint. On right-upper corner of android project click Gradle, choose Project Name > app > Tasks > android, and then click signingReport, as follows.

Note: Project Name depends on the user created name.

5. Create an App in AppGallery Connect.

6. Download the agconnect-services.json file from App information, copy and paste in android Project under app directory, as follows.

7. Enter SHA-256 certificate fingerprint and click tick icon, as follows.

Note: Above steps from Step 1 to 7 is common for all Huawei Kits.

8. Click Manage APIs tab and enable HUAWEI Analytics kit.

9. Add the below maven URL in build.gradle(Project) file under the repositories of buildscript, dependencies and allprojects, refer Add Configuration.

10. Add the below plugin and dependencies in build.gradle(Module) file.

11. Now Sync the gradle.

12. Add the below permissions in AndroidManifest.xml file.

Purpose of Analytics Kit

Analytics are useful for development process. It provides insights to your app, as follows:

  • Who all are using your app?
  • Which parts of the app they are interacting.
  • What actions they are taking within the app.

Based on the above insights you can improve your product, like adding new features which are required, or improve existing options to make use friendly, or remove features which are not used by users.

You can also gain insights whether you are achieving goals for your app, whether its revenue, awareness, or other KPIs, and then collect the data to adjust your approach and optimize your app accordingly to target further goals.

Development process

1. Enable the Debug Mode

During the development, you can enable the debug mode to view the event records in real time, observe the results, and adjust the event reporting policies.

Run the following command to enable the debug mode

Run the following command to disable the debug mode

After the debug mode is enabled, all events will be reported in App debugging. You can navigate to HUAWEI Analytics > App debugging to view the reported data.

2. Initialize Huawei Analytics and enable it.

3. Use below code to send custom events.

AppGallery Connect

Find the Analytics using AppGallery connect dashboard.

Choose My Projects > Huawei Analytics > Overview > Project overview.

Project overview displays the core indicators of current project, such as the number of new users and user activity, providing a quick overview of the users and how they are using your app.

1. On displayed image, you can find data of yesterday, including the number of new users, day-2 retention rate, number of active users, and average use duration.

2. On displayed image, you can find the trends in the number of new users, average number of sessions per user, average duration per user, and average page views per user.

When running an activity to attract new users, you can use this card to check the activity performance. Also you can find out how well your app is able to attract new users.

3. On displayed image, you can find the numbers of Events and Users, top 3 events of your app in the last 30 minutes and helps to track the latest status of your app in real time.

On User activity page, it displays the number of active users, average number of sessions, average access duration, and average page views. Click View user activity details in lower right-corner to view details of the activity analysis report.

4. On displayed image, you can find basic information about new or active user retention, helps to paint a picture that how attractive your app is to users over time. Find the information by day, week or month. Click the link in lower right corner to view the details.

5. On displayed image, you can find list of locations for all, new, or active users and device distribution. It allows to track which locations your app is most popular and on which devices.

On User revisit page, you can find daily distribution of users who has revisited your app, helps to evaluate how attractive your app is to users and the effect of efforts to win back churned users.

6. On displayed image, with the Crash SDK integrated, you can find the numbers of crashes and affected users of different apps in your project on App crash analysis page. Click View crash details to find details.

The App version analysis page uses a bar chart to display the app version adoption rate on different platforms. Click View version distribution to compare active user percentage of each version.

7. On displayed image, you can find daily launches, number and percentage of users brought by different callers in the last month.

Example: Number of users who has launched your app due to the pushed messages and the percentage of users who has launched proactively your app on each brand of mobile phone.

On Total revenue page, you can find the total sales revenue and revenue trend of INAPPPURCHASE and COMPLETEPURCHASE events that meets the filter criteria in a specified time segment. Click the View revenue in lower right corner to view the details.

Note:

  • The INAPPPURCHASE event is automatically collected when HUAWEI IAP has been integrated into your app.
  • The COMPLETEPURCHASE event is predefined, and tracking must be set for the events and parameters reported.

8. On displayed image, with the install attribution page, you can analyze the sources of users who has installed your app. To use this page, configure your message example, marketing channel, media, and task in HUAWEI Analytics > Management > Install referrer.

On Platform analysis can find user distribution by platform, such as Android, iOS and web. Click View all user group details to find the details.

9. On displayed image, you can find the total access percentage and average daily access duration of each page. It clearly provides that which app pages are most interest to users, and how attractive your app or operations strategy to users. For poor performance app pages, you can consider changing or optimizing the design of the page.

10. On displayed image, you can find comparison of the following indicators of your app against the industry benchmark such as, the numbers of new users, active users, and new users retained on the next day and app launches. It helps to evaluate the competitiveness of your app in the industry and provides references for app optimization.

Note: To use this function, choose Management > Analysis settings and enable Industry analysis. If the number of apps that contribute to the calculation is small, certain industry benchmark data cannot be calculated.

Result

Tips and Tricks

  • Make sure you are already registered as Huawei developer.
  • Enable HUAWEI Analytics service in the App Gallery.
  • Make sure your HMS Core is latest version.
  • Make sure you have added the agconnect-services.json file to app folder.
  • Make sure you have added SHA-256 fingerprint without fail.
  • Make sure all the dependencies are added properly.

Conclusion

In this article, we have learnt integration of Analytics Kit in food applications. Monitored the events in AppGallery Connect such as, Users data of yesterday, User acquisition, Access data in last 30 minutes, User Activity, New and Active user retention, User characteristics and User revisit, App crash and App version analysis, Launch analysis and Total revenue, Install attribution and Platform analysis, Popular pages, and Industry benchmark.

I hope you have read this article. If you found it is helpful, please provide likes and comments.

References

Analytics Kit

--

--

No responses yet