Making the warehouse

Github.com/fluttify-pr…

Rely on

dependencies:
  flutter:
    sdk: flutter
  janalytics_fluttify: ^x.x.x
Copy the code

configuration

Android

Add dependencies and replacement variables for AndroidManifest in Module gradle.

android {
    ......
    defaultConfig {
        applicationId "com.xxx.xxx" // The package name of your application.. manifestPlaceholders = [JPUSH_APPKEY : "Your appkey".// AppKey corresponding to the package name registered on JPush.
            JPUSH_CHANNEL : "developer-default".// Enter the default value for now.]... }... }Copy the code

The import

import 'package:janalytics_fluttify/janalytics_fluttify.dart';
Copy the code

use

Report the strategy

The JAnalytics Android SDK adopts the policy of separating data recording and data reporting. Data is recorded in real time and reported according to the report policy.

  • Opening application Report
  • Disabling Application Reporting

Note: If the data fails to be reported due to extreme circumstances, the data is not cleared and will be reported again after the next report policy triggers.

Initialize the

The initialization code is:

JAnalytics.init(iosKey: 'xxxx');
Copy the code

Initialization in the main method is recommended.

Whether to enable debug logs

JAnalytics.setDebugEnable(enable);
Copy the code

Set whether to enable the debug mode. True prints more log information. It is recommended to be called before the init interface.

Enable the crash log report function

JAnalytics.startCrashHandler();
Copy the code

Set the automatic statistics reporting period

JAnalytics.setReportPeriod(Duration(second: 60));
Copy the code

The minimum value is 10 seconds, and the maximum value is 1 day. If the value exceeds the range, a call failure log is displayed. If 0 is transmitted, statistics are reported immediately.

Custom events

By passing in different event models, various events are counted.

Note the following about user-defined events: The size of a string field (key or value) cannot exceed 256 bytes. If the number of key or value exceeds the limit, the event will be discarded. The number of user-defined key-value pairs cannot exceed 10. If the number exceeds 10, the event will be discarded.

Counting event model

This model is a custom counting event model, which can set parameters to report data.

The parameter name The parameter types Parameters that
eventId String Event Id(non-empty)
extMap Map<String, String> Extension parameters

The following key values cannot be used in extended parameters in the custom count event model:event_idThis type of key is used by the model. If used, the statistical data will be inaccurate.

Computational event model

This model is a custom calculation event model. The calculation events will be accumulated by the same event with different values, and the data can be reported by setting parameters.

The parameter name The parameter types Parameters that
eventId String Event Id(non-empty)
eventValue double Event value (non-null)
extMap Map<String, String> Extension parameters

The following key values cannot be used in extended parameters in the custom calculated event model:event_id event_valueThis type of key is used by the model. If used, the statistical data will be inaccurate.

Login event model

This model is a login event model, and you can set parameters to report data.

The parameter name The parameter types Parameters that
loginMethod String Login method (non-empty)
loginSuccess bool Login successful (not empty)
extMap Map<String, String> Extension parameters

The following key values cannot be used in extended parameters in the login event model:login_method login_successThis type of key is used by the model. If used, the statistical data will be inaccurate.

Register event model

This model is a registered event model, and parameters can be set for data reporting.

The parameter name The parameter types Parameters that
registerMethod String Registration method (non-empty)
registerSuccess bool Registration successful (not empty)
extMap Map Extension parameters

Browse event model

This model is a browse event model, and you can set parameters to report data.

The parameter name The parameter types Parameters that
browseId String Browse content ID
browseName String Content name (non-empty)
browseType String Content type
browseDuration Duration Viewing hours
extMap Map<String, String> Extension parameters

The following key values cannot be used in extended parameters in the browse event model:browse_content_id browse_name browse_type browse_durationThis type of key is used by the model. If used, the statistical data will be inaccurate.

Purchase event model

This model is a purchase event model, and parameters can be set for data reporting.

The parameter name The parameter types Parameters that
purchaseGoodsid String Product id
purchaseGoodsName String Name of commodity
purchasePrice double Purchase Price (not empty)
purchaseSuccess bool Whether the purchase was successful (not empty)
purchaseCurrency Currency Currency type, an enumeration class
purchaseGoodsType String Commodity type
purchaseGoodsCount int The number
extMap Map Extension parameters

Account dimension model

Developers can add account information for users, so that statistical data can be analyzed statistically by account dimension. The attributes currently developed are as follows:

Chinese name The English name type Authentication/Remarks
Account ID accountID String
Account Creation Time creationTime DateTime The time stamp
The name name String
gender sex Gender 0 Unknown 1 Male 2 female/The value cannot be other digits. The default value is 0
Whether to pay paid Paid 0 Unknown 1 Yes 2 No/The value cannot be other digits. The default value is 0
Date of birth birthdate DateTime Verification in the yyyyMMdd format
Mobile phone number phone String Mobile phone number verification
E-mail email String Mailbox format verification
Sina Weibo ID weiboID String
WeChat ID wechatID String
QQ ID qqID String
Custom dimensions extra key-value The key can be a string, and the value can be a string, number, or null. When value is set to null, remove the key from the server. The key cannot use aurora internal namespace (symbol $)

Method of use

JAnalytics.identifyAccount(Account(... Parameters to set));Copy the code

You can also change the account information by calling identifyAccount again, setting only some properties. To unbind current user information, call

JAnalytics.detachAccount();
Copy the code

Page flow statistics

Page started

JAnalytics.onPageStart('Page name');
Copy the code

Page startup interface. Called during the relevant life cycle of the page (widget), and onPageEnd should be called in pairs;

End of the page

JAnalytics.onPageEnd('Page name');
Copy the code

Page end interface. Called during the relevant life cycle of the page (widget), and onPageStart needs to be called in pairs;

Automatically collects page information

MaterialApp(
 navigatorObservers: [
   PageAnalyzer(),
 ],
)
Copy the code

community

QQ group 938842596

LICENSE

Copyright (C) 2020 yohom

This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with this program. If not, see www.gnu.org/licenses/.