huawei_analytics 5.0.3+300
huawei_analytics: ^5.0.3+300

Flutter Android iOS

HUAWEI Analytics Kit plugin for Flutter. Analytics Kit offers you a range of preset analytics models so you can gain a deeper insight into your users, products, and content.

Huawei Analytics Kit Flutter Plugin #


Contents #


1. Introduction #

This plugin enables communication between Huawei Analytics SDK and Flutter platform.

Analytics Kit offers you a range of preset analytics models so you can gain a deeper insight into your users, products, and content. With this insight, you can take a data-driven approach to market your apps and optimize your products.

With Analytics Kit's on-device data collection SDK, you can:
  • Track and report on custom events.

  • Set up to 25 user attributes.

  • Automate event collection and session calculation.

  • Preset event IDs and parameters.

Use Case
  • Analyze user behavior using both predefined and custom events.

  • Use audience building to tailor your marketing activity to your users' behaviors and preferences.

  • Use dashboards and analytics to measure your marketing activity and identify areas to improve.


2. Installation Guide #

Before you get started, you must register as a HUAWEI Developer and complete identity verification on the HUAWEI Developer website. For details, please refer to Register a HUAWEI ID.

Creating a Project in AppGallery Connect #

Creating an app in AppGallery Connect is required in order to communicate with the Huawei services. To create an app, perform the following steps:

Step 1. Sign in to AppGallery Connect and select My projects.

Step 2. Select your project from the project list or create a new one by clicking the Add Project button.

Step 3. Go to Project Setting > General information, and click Add app. If an app exists in the project and you need to add a new one, expand the app selection area on the top of the page and click Add app.

Step 4. On the Add app page, enter the app information, and click OK.

Configuring the Signing Certificate Fingerprint #

A signing certificate fingerprint is used to verify the authenticity of an app when it attempts to access an HMS Core (APK) through the HMS SDK. Before using the HMS Core (APK), you must locally generate a signing certificate fingerprint and configure it in the AppGallery Connect. You can refer to 3rd and 4th steps of Generating a Signing Certificate codelab tutorial for the certificate generation. Perform the following steps after you have generated the certificate.

Step 1: Sign in to AppGallery Connect and select your project from My Projects. Then go to Project Setting > General information. In the App information field, click the icon next to SHA-256 certificate fingerprint, and enter the obtained SHA-256 certificate fingerprint.

Step 2: After completing the configuration, click OK to save the changes. (Check mark icon)

Integrating the Flutter Analytics Plugin #

Android App Development

Step 1: Sign in to AppGallery Connect and select your project from My Projects. Then go to Growing > Analytics Kit and click Enable Now to enable the Huawei Analytics Kit Service. You can also check Manage APIs tab on the Project Settings page for the enabled HMS services on your app.

Step 2: Go to Project Setting > General information page, under the App information field, click agconnect-services.json to download the configuration file.

Step 3: Copy the agconnect-services.json file to the android/app directory of your project.

Step 4: Open the build.gradle file in the android directory of your project.

  • Navigate to the buildscript section and configure the Maven repository address and agconnect plugin for the HMS SDK.

    buildscript {
      repositories {
          google()
          jcenter()
          maven { url 'https://developer.huawei.com/repo/' }
      }
    
      dependencies {
          /* 
            * <Other dependencies>
            */
          classpath 'com.huawei.agconnect:agcp:1.4.1.300'
      }
    }
    
  • Go to allprojects and configure the Maven repository address for the HMS SDK.

    allprojects {
      repositories {
          google()
          jcenter()
          maven { url 'https://developer.huawei.com/repo/' }
      }
    }
    

Step 5: Open the build.gradle file in the android/app/ directory.

  • Add apply plugin: 'com.huawei.agconnect' line after other apply entries.

    apply plugin: 'com.android.application'
    apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle"
    apply plugin: 'com.huawei.agconnect'
    
  • Set your package name in defaultConfig > applicationId and set minSdkVersion to 17 or higher. Package name must match with the package_name entry in agconnect-services.json file.

    defaultConfig {
        applicationId "<package_name>"
        minSdkVersion 17
        /*
        * <Other configurations>
        */
    }
    

Step 6: Copy the signature file that generated in Generating a Signing Certificate to android/app directory.

Step 7: Edit buildTypes as follows and add signingConfigs below:

signingConfigs {
    config {
        storeFile file('<keystore_file>.jks/.keystore')
        storePassword '<keystore_password>'
        keyAlias '<key_alias>'
        keyPassword '<key_password>'
    }
}
buildTypes {
    debug {
        signingConfig signingConfigs.config
    }
    release {
        signingConfig signingConfigs.config
    }
}

NOTE

  • Before obtaining the agconnect-services.json file, ensure that HUAWEI Analytics Kit has been enabled. For details about how to enable HUAWEI Analytics Kit, please refer to Enabling Required Services.
  • If you have made any changes in the development module, such as setting the data storage location and enabling or managing APIs, you need to download the latest agconnect-services.json file and replace the existing file in the app directory.

Step 8: On your Flutter project directory, find and open your pubspec.yaml file and add the huawei_analytics library to dependencies. For more details please refer to the Using packages document.

  • To download the package from pub.dev.

      dependencies:
        huawei_analytics: {library version}
    

    or

    If you downloaded the package from the HUAWEI Developer website, specify the library path on your local device.

      dependencies:
        huawei_analytics:
            # Replace {library path} with actual library path of Huawei Analytics Kit Plugin for Flutter.
            path: {library path}
    
    • Replace {library path} with the actual library path of Analytics Analytics Plugin. The following are examples:
      • Relative path example: path: ../huawei_analytics
      • Absolute path example: path: D:\Projects\Libraries\huawei_analytics

Step 9: Run the following command to update package info.

[project_path]> flutter pub get

Step 10: Import the library to access the methods.

import 'package:huawei_analytics/huawei_analytics.dart';

Step 11: Run the following command to start the app.

[project_path]> flutter run

iOS App Development

Step 1: Sign in to AppGallery Connect and select your project from My Projects. Then go to Growing > Analytics Kit and click Enable Now to enable the Huawei Analytics Kit Service. You can also check Manage APIs tab on the Project Settings page for the enabled HMS services on your app.

Step 2: Go to Project Setting > General information page, under the App information field, click agconnect-services.plist to download the configuration file.

Step 3: Copy the agconnect-services.plist file to the app's root directory of your Xcode project.

NOTE

  • Before obtaining the agconnect-services.plist file, ensure that HUAWEI Analytics Kit has been enabled. For details about how to enable HUAWEI Analytics Kit, please refer to Enabling Required Services.

  • If you have made any changes in the development module, such as setting the data storage location and enabling or managing APIs, you need to download the latest agconnect-services.plist file and replace the existing file in the app directory.

Step 4: On your Flutter project directory, find and open your pubspec.yaml file and add the huawei_analytics library to dependencies. For more details please refer to the Using packages document.

  • To download the package from pub.dev.

      dependencies:
        huawei_analytics: {library version}
    

    or

    If you downloaded the package from the HUAWEI Developer website, specify the library path on your local device.

      dependencies:
        huawei_analytics:
            # Replace {library path} with actual library path of Huawei Analytics Kit Plugin for Flutter.
            path: {library path}
    
    • Replace {library path} with the actual library path of Analytics Analytics Plugin. The following are examples:
      • Relative path example: path: ../huawei_analytics
      • Absolute path example: path: D:\Projects\Libraries\huawei_analytics

Step 5: Run the following command to update package info.

[project_path]> flutter pub get

Step 6: Import the library to access the methods.

import 'package:huawei_analytics/huawei_analytics.dart';

Step 7: Run the following command to start the app.

[project_path]> flutter run

Using the Debug Mode

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

Enabling/Disabling the Debug Mode
  • To enable the debug mode:

    Choose Product > Scheme > Edit Scheme from the Xcode menu. On the Arguments page, click + to add the -HADebugEnabled parameter. After the parameter is added, click Close to save the setting.

  • To disable the debug mode:

    -HADebugDisabled
    

After the data is successfully reported, you can go to HUAWEI Analytics > App Debugging to view the reported data, as shown in the following figure.

Adjusting the Log Level by Adding Arguments

You can adjust the log level by adding arguments.

The available options include -HALogLevelDebug, -HALogLevelInfo, -HALogLevelWarn, and -HALogLevelError. For example, if you want to set the log level to -HALogLevelDebug:

  1. Choose Product > Scheme > Edit Scheme from the Xcode menu.
  2. On the Arguments page, click + to add the -HALogLevelDebug parameter.
  3. After the parameter is added, click Close to save the setting.

Events

The HUAWEI Analytics Kit server provides three types of events for developers, including automatically collected events, preset events, and custom events.

Automatically Collected Event

Such events can be automatically collected without tracing points, and the only requirement is that the function of collecting system events is enabled. (The function is automatically enabled during initiation.) More Details

Preset Events

The HMS Core Analytics Plugin predefines some event IDs based on common application scenarios. It is recommended that predefined constants be used for burying tracing points and analysis. The system provides various insight reports based on preset events.

Custom Events

You can report custom events for personalized analysis requirements that cannot be met by automatically collected events and preset events.

To access PresetEvents, you can use this :

HmsAnalytics.HAEventType

To access preset bundleName, you can use this :

HmsAnalytics.HaParamType


3. API Reference #

HMSAnalytics #

Contains classes that provide methods to perform operations such as event logging and reporting, real-time data collection and reporting, user attribute configuration, automatic event collection, and session calculation.

Public Constructor Summary

ConstructorDescription
HMSAnalytics()Default constructor.

Public Method Summary

MethodReturn TypeDescription
enableLog()Future<void>This API is called to enable the HUAWEI Analytics Kit log function.
enableLog(String LogLevel)Future<void>This API is called to enable debug logs and set the minimum log level (minimum level of log records that will be printed).
setUserId(String id)Future<void>This API is called to set user IDs.
setUserProfile(String key, String value)Future<void>This API is called to set user attributes.
setPushToken(String token)Future<void>This API is called to set the push token, which can be obtained from HUAWEI Push Kit.
setMinActivitySessions(int interval)Future<void>This API is called to set the minimum interval between two sessions.
setSessionDuration(int duration)Future<void>This API is called to set the session timeout interval.
onEvent(String key, Map<String, dynamic> value)Future<void>This API is called to record events.
clearCachedData()Future<void>This API is called to delete all collected data cached locally, including cached data that failed to be sent.
getAAID()Future<String>This API is called to obtain the app instance ID from AppGalleryConnect.
getUserProfiles(bool preDefined)Future<Map<String, String>>This API is called to obtain user attributes.
pageStart(String pageName, String pageClassOverride)Future<void>This API is called to customize the screen start event.
pageEnd(String pageName)Future<void>This API is called to customize the screen end event.
enableLogger()Future<void>Enables HMS Plugin Method Analytics.
disableLogger()Future<void>Disables HMS Plugin Method Analytics.
setReportPolicies(String policyType, [int timer])Future<void>Sets data reporting policies.

Public Constructors

HMSAnalytics()

Constructor for HMSAnalytics object.

Public Methods

Future<void> enableLog() async

Provides methods to enable debug log recording for debugging during the development phase. This function is specifically used by Android Platforms.

Return TypeDescription
Future<void>Future result of an execution that returns no value.
Future<void> enableLog(String logLevel) async

Enables the debug log function and sets the minimum log level. This function is specifically used by Android Platforms.

ParameterDescription
logLevelLevel of recorded debug logs. Log level: - DEBUG - INFO - WARN - ERROR
Return TypeDescription
Future<void>Future result of an execution that returns no value.
Future<void> setUserId(String userId) async

Sets a user ID.

When the API is called, a new session is generated if the old value of id is not empty and is different from the new value. If you do not want to use id to identify a user (for example, when a user signs out), you must set id to Null.

id is used by Analytics Kit to associate user data. The use of id must comply with related privacy regulations. You need to declare the use of such information in the privacy statement of your app.

ParameterDescription
userIdUser ID, a string containing a maximum of 256 characters. The value cannot be empty.
Return TypeDescription
Future<void>Future result of an execution that returns no value.
Future<void> setUserProfile(String key, String value) async

Sets user attributes. The values of user attributes remain unchanged throughout the app lifecycle and during each session. A maximum of 25 user attributes are supported. If the name of an attribute set later is the same as that of an existing attribute, the value of the existing attribute is updated.

ParameterDescription
keyName of the user attribute, a string containing a maximum of 256 characters. The value cannot be empty. It can consist of digits, letters, and underscores () but cannot start with a digit or underscore ().
valueValue of the user attribute, a string containing a maximum of 256 characters. The value cannot be empty.
Return TypeDescription
Future<void>Future result of an execution that returns no value.
Future<void> setPushToken(String token) async

Sets the push token. After obtaining a push token through Push Kit, call this method to save the push token so that you can use the audience defined by HUAWEI Analytics to create HCM notification tasks. This function is specifically used by Android Platforms.

ParameterDescription
tokenPush token, a string containing a maximum of 256 characters. The value cannot be empty.
Return TypeDescription
Future<void>Future result of an execution that returns no value.
Future<void> setMinActivitySessions(int interval) async

Sets the minimum interval for starting a new session. A new session is generated when an app is switched back to the foreground after it runs in the background for the specified minimum interval. By default, the minimum interval is 30,000 milliseconds (that is, 30 seconds). This function is specifically used by Android Platforms.

ParameterDescription
intervalMinimum interval for updating a session, in milliseconds.
Return TypeDescription
Future<void>Future result of an execution that returns no value.
Future<void> setSessionDuration(int duration) async

Sets the session timeout interval. A new session is generated when an app is running in the foreground but the interval between two adjacent events exceeds the specified timeout interval. By default, the timeout interval is 1,800,000 milliseconds (that is, 30 minutes).

ParameterDescription
durationSession timeout interval, in milliseconds.
Return TypeDescription
Future<void>Future result of an execution that returns no value.
Future<void> onEvent(String key, Map<String, dynamic> value) async

Records an event.

ParameterDescription
keyEvent ID, a string containing a maximum of 256 characters. The value cannot be empty or the ID of an automatically collected event. It can consist of digits, letters, and underscores (_) but cannot contain spaces or start with a digit.Example: event_description10
valueInformation carried in the event. The number of key-value pairs in a bundle must not exceed 2048. In addition, its size cannot exceed 200 KB.
Return TypeDescription
Future<void>Future result of an execution that returns no value.
Future<void> clearCachedData() async

Deletes all collected data cached locally, including cached data that failed to be sent.

Return TypeDescription
Future<void>Future result of an execution that returns no value.
Future<String> getAAID() async

Obtains the app instance ID from AppGallery Connect.

Return TypeDescription
Future<String>Obtains the app instance ID.
Future<Map<String, dynamic>> getUserProfiles(bool preDefined) async

Obtains predefined and custom user attributes in A/B Testing.

ParameterDescription
preDefinedIndicates whether to obtain predefined user attributes. **true : ** Obtains predefined user attributes. false : Obtains custom user attributes.
Return TypeDescription
Future<Map<String, dynamic>>Obtains the predefined or custom user attributes.
Future<void> pageStart(String pageName, String pageClassOverride) async

Customizes a page entry event. The API applies only to non-activity pages because automatic collection is supported for activity pages. If this API is called for an activity page, statistics on page entry and exit events will be inaccurate.

After this API is called, the pageEnd() API must be called. This function is specifically used by Android Platforms.

ParameterDescription
pageNameName of the current page, a string containing a maximum of 256 characters. The value cannot be empty.
pageClassOverrideClass name of the current page, a string containing a maximum of 256 characters. The value cannot be empty.
Return TypeDescription
Future<void>Future result of an execution that returns no value.
Future<void> pageEnd(String pageName) async

Customizes a page end event. The API applies only to non-activity pages because automatic collection is supported for activity pages. If this API is called for an activity page, statistics on page entry and exit events will be inaccurate. Before this API is called, the pageStart() API must be called. This function is specifically used by Android Platforms.

ParameterDescription
pageNameName of the current page, a string containing a maximum of 256 characters. The value cannot be empty. It must be the same as the value of pageName passed in pageStart().
Return TypeDescription
Future<void>Future result of an execution that returns no value.
Future<void> enableLogger() async

This method enables the HMSLogger capability which is used for sending usage analytics of Analytics SDK's methods to improve the service quality. This function is specifically used by Android Platforms.

Return TypeDescription
Future<void>Future result of an execution that returns no value.
Future<void> disableLogger() async

This method disables the HMSLogger capability which is used for sending usage analytics of Analytics SDK's methods to improve the service quality. This function is specifically used by Android Platforms.

Return TypeDescription
Future<void>Future result of an execution that returns no value.
Future<void> setReportPolicies({int scheduledTime, bool appLaunch, bool moveBackground, int cacheThreshold}) async

Sets data reporting policies. This function is specifically used by IOS Platforms.

ParameterDescription
scheduledTimeSets the policy of reporting data at the scheduled interval. You can configure the interval as needed. The value ranges from 60 to 1800, in seconds.
appLaunchSets the policy of reporting data upon app launch.
moveBackgroundSets the policy of reporting data when the app moves to the background. This policy is enabled by default.
cacheThresholdSets the policy of reporting data when the specified threshold is reached. This policy is enabled by default. You can configure the interval as needed. The value ranges from 30 to 1000. The default value is 200.
Return TypeDescription
Future<void>Future result of an execution that returns no value.

HAEventType #

Provides the IDs of all predefined events.

Public Constants

Click to expand/collapse Constants table
ConstantsTypeDescription
CREATEPAYMENTINFOStringEvent reported when a user has added payment information but has not initiated payment during check-out.It can be used with STARTCHECKOUT and COMPLETEPURCHASE to construct funnel analysis for the check-out process.
ADDPRODUCT2CARTStringEvent reported when a user adds a product to the shopping cart.It can be used with VIEWPRODUCT and STARTCHECKOUT to construct funnel analysis for product purchase. It can also be used to analyze products that users are interested in, helping you promote the products to the users.
ADDPRODUCT2WISHLISTStringEvent reported when a user adds a product to wishlist.It can be used to analyze products that users are interested in, helping you promote the products to the users.
STARTAPPStringEvent reported when a user launches the app.
STARTCHECKOUTStringEvent reported when a user clicks the check-out button after placing an order. It can be used with VIEWPRODUCT and COMPLETEPURCHASE to construct funnel analysis for the e-commerce purchase conversion rate.
VIEWCAMPAIGNStringEvent reported when a user views details of a marketing campaign. It can be used to analyze the conversion rate of a marketing campaign.
VIEWCHECKOUTSTEPStringEvent reported when a user views steps of the check-out process.
WINVIRTUALCOINStringEvent reported when a user obtains virtual currency. It can be used to analyze the difficulty for users to obtain virtual currency, which helps you optimize the product design.
COMPLETEPURCHASEStringEvent reported after a user purchases a product. It can be used to analyze the products or contents that users are more interested in, which helps you optimize the operations policy.
OBTAINLEADSStringEvent reported when a sales lead is obtained. For example, it can be reported after a user taps the ad you placed and fills in and submits the contact information. In this case, the event is used to evaluate the possible revenue brought by the lead to you. In addition, the event can also be used to evaluate the ROI of the placed ad.
JOINUSERGROUPStringEvent reported when a user joins in a group, for example, joining in a group chat in a social app. It can be used to evaluate the attractiveness of your product's social features to users.
COMPLETELEVELStringEvent reported when a user completes a game level in a game app. It can be used with STARTLEVEL to analyze whether the game level design is proper and formulate targeted optimization policies.
STARTLEVELStringEvent reported when a user starts a game level in a game app. It can be used with COMPLETELEVEL to analyze whether the game level design is proper and formulate targeted optimization policies.
UPGRADELEVELStringEvent reported when a user levels up in a game app. It can be used to analyze whether your product's user level design is optimal and formulate targeted optimization policies.
SIGNINStringEvent reported when a user signs in to an app requiring sign-in. It can be used to analyze users' sign-in habits and formulate targeted operations policies.
SIGNOUTStringEvent reported when a user signs out.
SUBMITSCOREStringEvent reported when a user submits the score in a game or education app. It can be used to analyze the difficulty of product content and formulate targeted optimization policies.
CREATEORDERStringEvent reported when a user creates an order.
REFUNDORDERStringEvent reported when the refund is successful for a user. It can be used to analyze loss caused by the refund and formulate targeted optimization policies.
DELPRODUCTFROMCARTStringEvent reported when a user removes a product from the shopping cart. It can be used for targeted marketing to the user.
SEARCHStringEvent reported when a user searches for content in an app. It can be used with events such as VIEWSEARCHRESULT and VIEWPRODUCT to analyze the accuracy of search results.
VIEWCONTENTStringEvent reported when a user taps content, for example, tapping a product in the product list in an e-commerce app to view the product details. It can be used to analyze the products that users are interested in.
UPDATECHECKOUTOPTIONStringEvent reported when a user sets some check-out options during the check-out process. It can be used to analyze check-out preferences of users.
SHARECONTENTStringEvent reported when a user shares a product or content through a social channel. It can be used to analyze users' loyalty to the product.
REGISTERACCOUNTStringEvent reported when a user registers an account. It can be used to analyze the user sources and optimize operations policies.
CONSUMEVIRTUALCOINStringEvent reported when a user consumes virtual currency. It can be used to analyze the products that users are more interested in.
STARTTUTORIALStringEvent reported when a user starts to use the tutorial. It can be used with COMPLETETUTORIAL to evaluate the tutorial quality and formulate targeted optimization policies.
COMPLETETUTORIALStringEvent reported when a user completes the tutorial. It can be used with STARTTUTORIAL to evaluate the tutorial quality and formulate targeted optimization policies.
OBTAINACHIEVEMENTStringEvent reported when a user unlocks an achievement. It can be used to analyze whether the achievement level design is optimal and formulate targeted optimization policies.
VIEWPRODUCTStringEvent reported when a user browses a product. It can be used to analyze the products that users are interested in, or used with other events for funnel analysis.
VIEWPRODUCTLISTStringEvent reported when a user browses a list of products, for example, browsing the list of products by category. It can be used to analyze the types of contents that users are more interested in.
VIEWSEARCHRESULTStringEvent reported when a user views the search results. It can be used with VIEWPRODUCT and SEARCH to measure the accuracy of the search algorithm.
UPDATEMEMBERSHIPLEVELStringEvent reported when a user purchases membership or signs in for the first time after membership expires. It can be used to analyze user habits.
FILTRATEPRODUCTStringEvent reported when a user sets conditions to filter products displayed. It can be used to analyze user preferences.
VIEWCATEGORYStringEvent reported when a user taps a product category. It can be used to analyze popular product categories or user preferences.
UPDATEORDERStringEvent reported when a user modifies an order.
CANCELORDERStringEvent reported when a user cancels an order.
COMPLETEORDERStringEvent reported when a user confirms the reception.
CANCELCHECKOUTStringEvent reported when a user cancels an ongoing payment of a submitted order. It can be used to analyze the cause of user churn.
OBTAINVOUCHERStringEvent reported when a user claims a voucher.
CONTACTCUSTOMSERVICEStringEvent reported when a user contacts customer service personnel to query product details or make a complaint.
RATEStringEvent reported when a user comments on an app, service, or product.
INVITEStringEvent reported when a user invites other users to use the app through the social channel.

HAParamType #

Provides the IDs of all predefined parameters, including the IDs of predefined parameters and user attributes.

Public Constants

Click to expand/collapse Constants table
ConstantsTypeDescription
ACHIEVEMENTIDStringID of an achievement.
STORENAMEStringStore or organization where a transaction occurred.
ROLENAMEStringRole of a user.
OPTIONStringCheck-out option entered by a user in the current check-out step.
STEPStringCurrent step of a user in the check-out process.
CONTENTTYPEStringContent type selected by a user.
VOUCHERStringVoucher used in the transaction.
CURRNAMEStringCurrency type of the revenue, which is used with REVENUE.
DESTINATIONStringFlight or travel destination.
ENDDATEStringProject end date, check-out date, or lease end date.
FLIGHTNOStringFlight number generated by your transaction system.
USERGROUPIDStringID of the user group that a user joins.
POSITIONIDStringIndex of a product in the list.
BRANDStringProduct brand.
CATEGORYStringProduct category.
PRODUCTIDStringProduct ID.
PRODUCTLISTStringProduct list displayed to a user.
PRODUCTNAMEStringProduct name.
PRODUCTFEATUREStringProduct features.
LEVELIDStringGame level.
LEVELNAMEStringName of a game level.
PLACEStringID of the product location.
CHANNELStringChannel through which a user signs in.
BOOKINGDAYSStringNumber of days booked for a hotel reservation.
PASSENGERSNUMBERStringNumber of guests booked for a hotel reservation.
BOOKINGROOMSStringNumber of rooms booked for a hotel reservation.
ORIGINATINGPLACEStringDeparture location.
PRICEStringPurchase price.
QUANTITYStringPurchase quantity.
SCOREStringScore in a game.
SEARCHKEYWORDSStringSearch string or keyword.
SHIPPINGStringShipping fee generated for the transaction.
BEGINDATEStringDeparture date, hotel check-in date, or lease start date.
RESULTStringOperation result.
TAXFEEStringTax generated for the transaction.
KEYWORDSStringKeywords of a marketing activity, for example, keywords for search advertising.
TRANSACTIONIDStringE-commerce transaction ID.
CLASSStringLevel of a room booked for a hotel reservation.
REVENUEStringContext-specific value that is automatically accumulated for each event type.
VIRTUALCURRNAMEStringVirtual currency type.
CLICKIDStringID generated by the ad network and used to record ad clicks.
PROMOTIONNAMEStringName of a marketing activity.
CONTENTStringMarketing content of a marketing activity.
EXTENDPARAMStringCustom parameter.
MATERIALNAMEStringName of the creative material used in a marketing activity.
MATERIALSLOTStringID of the slot where a creative material is displayed.
PLACEIDStringID of the product location.
MEDIUMStringType of a marketing activity, for example, CPC or email.
SOURCEStringID of a marketing activity provider, for example, HUAWEI PPS.
ACOUNTTYPEStringAccount type of a user, for example, email or mobile number.
REGISTMETHODStringUser source.
OCCURREDTIMEStringTime when an account is registered.
EVTRESULTStringSign-in result.
PREVLEVELStringLevel before the change.
CURRVLEVELStringCurrent level.
REASONStringChange reason.
VOUCHERSStringNames of vouchers applicable to a product.
MATERIALSLOTTYPEStringType of the slot where a creative material is displayed, for example, the ad slot, operations slot, or banner.
LISTIDStringProduct ID list.
FILTERSStringFilter condition.
SORTSStringSorting condition.
ORDERIDStringOrder ID generated by your transaction system.
PAYTYPEStringPayment mode selected by a user.
EXPIREDATEStringExpiration time of a voucher.
VOUCHERTYPEStringVoucher type.
SERVICETYPEStringType of a service provided for a user, for example, consultation or complaint.
DETAILSStringDetails of user evaluation on an object.
COMMENTTYPEStringEvaluated object.

You can read more and get detailed information about the references described above from developer.huawei.com


4. Configuration Description #

Preparing for Release #

Before building a release version of your app you may need to customize the proguard-rules.pro obfuscation configuration file to prevent the HMS Core SDK from being obfuscated. Add the configurations below to exclude the HMS Core SDK from obfuscation. For more information on this topic refer to this Android developer guide.

<flutter_project>/android/app/proguard-rules. pro

-ignorewarnings
-keepattributes *Annotation*
-keepattributes Exceptions
-keepattributes InnerClasses
-keepattributes Signature
-keepattributes SourceFile,LineNumberTable
-keep class com.hianalytics.android.**{*;}
-keep class com.huawei.updatesdk.**{*;}
-keep class com.huawei.hms.**{*;}

<flutter_project>/android/app/build.gradle

buildTypes {
    debug {
        signingConfig signingConfigs.config
    }
    release {
        
        // Enables code shrinking, obfuscation and optimization for release builds
        minifyEnabled true
        // Unused resources will be removed, resources defined in the res/raw/keep.xml will be kept.
        shrinkResources true
        proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
	
	signingConfig signingConfigs.config
    }
}

5. Sample Project #

This plugin includes a demo project in the example folder, there you can find more usage examples.


6. Questions or Issues #

If you have questions about how to use HMS samples, try the following options:

  • Stack Overflow is the best place for any programming questions. Be sure to tag your question with huawei-mobile-services.
  • Github is the official repository for these plugins, You can open an issue or submit your ideas.
  • Huawei Developer Forum HMS Core Module is great for general questions, or seeking recommendations and opinions.
  • Huawei Developer Docs is place to official documentation for all HMS Core Kits, you can find detailed documentations in there.

If you run into a bug in our samples, please submit an issue to the Github Repository.


7. Licensing and Terms #

Huawei Analytics Kit Flutter Plugin - is licensed under Apache 2.0 license

6
likes
90
pub points
71%
popularity

Publisher

developer.huawei.com

HUAWEI Analytics Kit plugin for Flutter. Analytics Kit offers you a range of preset analytics models so you can gain a deeper insight into your users, products, and content.

Homepage
Repository (GitHub)
View/report issues

Documentation

API reference

License

Apache 2.0 (LICENSE)

Dependencies

flutter

More

Packages that depend on huawei_analytics