mzanalytics_mybmw 0.3.0 copy "mzanalytics_mybmw: ^0.3.0" to clipboard
mzanalytics_mybmw: ^0.3.0 copied to clipboard

unlistedoutdated

One for BMW Group to use flutter plug-in, data collection and analysis.

秒针分析SDK部署指南(Flutter测试版本) #

A mzanalytics_mybmw flutter plugin project.

一、准备工作 🍭 #

1. 版本限制 #

  • Flutter SDK:>=1.17.0

  • Xcode 版本: >=12.0

  • *MZAnalyticsIOS*SDK**适用于 iOS 9-iOS 14.0,请将iOS Deployment Target设置为iOS 9.0,

  • *MZAnalyticsAndroid*SDK适用于Android 2.3.3(API Level 10)**及以上的设备。

建议: #

建议将sdk初始化方法放在获取设备id、存储等权限后执行,若将sdk 初始化方法放在授权之前,可能会影响激活归因等数据的准确性。

2. Flutter项目添加依赖 #

mzanalytics_mybmw 添加至pubspec.yaml引用。

dependencies:  
mzanalytics_mybmw: ^${latestVersion}

在flutter项目中运行 flutter pub get


3. 集成准备 #

3.1 为应用申请AppID

在 https://tongji.cn.miaozhen.com 网站中创建一款应用,
您将获得一串随机的“dc-”开头的数字ID,用于唯一标识您的一款应用。

3.2 AppID说明

 appId为应用追踪的唯一标识,在站点信息内获取。

3.3 Android SDK 需获取OAID的配置

说明: 可依据客户个人需求决定是否配置。若配置,秒针分析SDK可采集OAID信息;若不配置,则不能采集OAID信息。请依据移动安全联盟官网推荐的MSA SDK集成方式引入。
移动安全联盟官网链接:https://msa-alliance.cn/col.jsp?id=120

3.4 Android SDK权限配置 #

以下权限根据客户实际需求进行配置:

权限 权限描述 是否可选 不授权的影响
INTERNET 允许程序联网 必选项 SDK无法发送数据
READ_PHONE_STATE 允许访问手机设备的唯一标识信息 可选项 SDK无法获取设备ID
ACCESS_WIFI_STATE 允许读取WiFi状态变化 可选项 影响数据SDK数据发送频率
READ_EXTERNAL_STORAGE 允许读取SD卡上存储的数据 必选项 影响SDK读取标识唯一用户的CID和发送失败的历史数据
WRITE_EXTERNAL_STORAGE 允许写入标识唯一用户的CID等信息到SD卡 必选项 影响SDK存储标识唯一用户的CID和发送失败的数据写入
示例代码:

<!-- 网络权限 -->
<uses-permission android:name="android.permission.INTERNET" />
<!-- 网络状态相关权限 -->
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.ACCESS_WIFI_STATE" />
<!-- 手机信息相关权限 -->
<uses-permission android:name="android.permission.READ_PHONE_STATE" />
<!-- SD卡读写权限 -->
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
    

4. 运行环境配置 #

4.1 iOS运行环境配置

a. cd到iOS项目目录。   
b. 终端执行  `pod install`。   
c. 打开`Runner.xcworkspace` ,在`Pods->Development->mzanalytics_mybmw->..->Classes中找到sdkconfig.xml`, 拖到工程项目Runner中。

4.2 Android运行环境配置

a. 进入到android项目目录`app/src/main中`。       
b. 拷贝assets文件夹(包含sdkconfig.xml和supplierconfig.json)到`main`目录下。      
c. 在application标签中添加属性(appkey为纯数字): 
     <meta-data
       android:name="com.miaozhen.mzsdk.appKey"
       android:value="xxxx" />
     <meta-data
       android:name="com.miaozhen.mzsdk.channelId"
       android:value="xxxxx" />


二、秒针分析SDK使用 #

flutter代码中引入头文件:

import 'package:mzanalytics_mybmw/mzanalytics_mybmw.dart';

1、调用示例 #

1.1 初始化SDK (必选埋点)

使用时将xxxx替换为实际的AppId (Android需在application标签中配置)

接口定义:

 Future<void> appid(String aid)

参数说明:

参数 类型 说明
aid String 网站创建站点时的站点id为您的AppId。
示例代码 :   
//在 https://tongji.cn.miaozhen.com 网站中创建一款应用,站点id为dc-2814;将2814传入该接口

MzanalyticsMybmw.appid("2814");

1.2 页面监测 (可选埋点,与页面自动监听方案可二选一)

说明:用于采集页面浏览事件,在需要监测的页面启动方法中添加如下代码后,即可采集用户的页面浏览行为。

接口定义:

Future<void> trackPageView(Map parameter)

参数说明:

参数 类型 说明 是否必填
dt String 页面名称 必填

customDimMetrics中需传递的自定义参数说明:

参数 类型 说明 是否必填
cd[1~25] String 自定义维度 选填
cm[1~25] String 自定义指标 选填
不传递自定义维度和指标的示例代码:
MzanalyticsMybmw.trackPageView({"dt": "首页"});


传递自定义维度和指标的示例代码:
MzanalyticsMybmw.trackPageView({
                   "dt": "首页",
                 'CustomDimMetrics': {
                   "cd1": "账号名称",
                   "cm1": "数量1"
                 } 
});

1.3 自定义事件 (可选埋点)

说明:用户与App的交互动作,可添加自定义事件代码进行统计,在需要自定义埋点的按钮或其他控件的点击方法中,添加如下代码。

接口定义:

Future<void>  trackEvent(Map parameter)

参数说明:

参数 类型 说明 是否必填
ec String 事件分类 必填
ea String 事件动作 选填
el String 事件标签 选填
ev String 事件价值 选填

customDimMetrics中需传递的自定义参数说明:

参数 类型 说明 是否必填
cd[1~25] String 自定义维度 选填
cm[1~25] String 自定义指标 选填
 不传递自定义维度和指标的示例代码:
MzanalyticsMybmw.trackEvent({
               "ec": '点击热⻔banner',
               "ea": 'Click',
               "el": '点击',
               "ev": '0'
             });
             
传递自定义维度和指标的示例代码:
MzanalyticsMybmw.trackEvent({
                   "ec": '点击热⻔banner',
                       "ea": 'Click',
                       "el": '点击',
                      "ev": '0',
                 'CustomDimMetrics': {
                   "cd1": "账号名称",
                   "cm1": "数量1"
                 }
                 });

1.4 高级自定义事件 (可选埋点)

说明:高级事件统计代码可统计更多维度、指标的用户交互事件。用户可根据统计业务需要,设定所要统计的维度、指标。

接口定义:

Future<void>  trackSiteCustomEvent(Map parameter) 

参数说明:

参数 类型 说明 是否必填
customEvent Map 包含高级事件id、以及高级事件维度、指标数均以实际在系统中创建的⾼级事件为准 必填
customDimMetrics Map 自定义维度和指标 可选,没有自定义维度和自定义指标时,customDimMetrics可不传

CustomEvent中需传递的高级事件参数说明:

参数 类型 说明 是否必填
caid String 高级事件id 必填
cal[1~20] String 高级事件维度 选填
cav[1~20] String 高级事件指标 选填

customDimMetrics中需传递的自定义参数说明:

参数 类型 说明 是否必填
cd[1~25] String 自定义维度 选填
cm[1~25] String 自定义指标 选填
 不传递自定义维度和指标的示例代码:
 MzanalyticsMybmw.trackSiteCustomEvent({
                 'CustomEvent': {
                   "caid": "1",
                   "cal1": "2020/01/10",
                   "cal2": "15728749249",
                   "cal3": "北京",
                   "cav1": "2"
                 }
               });


传递自定义维度和指标的示例代码:
 MzanalyticsMybmw.trackSiteCustomEvent({
                 'CustomEvent': {
                   "caid": "1",
                   "cal1": "2020/01/10",
                   "cal2": "15728749249",
                   "cal3": "北京",
                   "cav1": "2"
                 },
                 'CustomDimMetrics': {
                   "cd1": "点击信用卡",
                   "cd2": "查看商品详情",
                   "cm1": "点击信用卡总用户数",
                   "cm2": "查看商品详情总用户数"
                 }
               });

备注:

高级事件ID必传。     
cal最多20个,名称为cal1~20。       
cav最多20个,名称为cav1~20。       
cd最多25个,名称为cd1~25。     
cm最多25个,名称为cm1~25。     

实际使用时将高级事件维度、高级事件指标、自定义维度、自定义指标替换为实际回传值。

1.5 心跳事件 (可选埋点)

说明:可在用户退出App或页面时埋点该事件,用于统计更准确的App使用时长。

接口定义:

 Future<void> trackPulse()

参数说明: 无

示例代码:

 MzanalyticsMybmw.trackPulse();

1.6 获取访客id(设备唯一ID,可用于客户测试)

说明:访客id是秒针分析标识唯一用户的id,该接口多用于客户测试场景。

接口定义:

  Future<String> getCid() 

参数说明: 无

示例代码:

 MzanalyticsMybmw.getCid();

1.7 获取oaid(仅对Android有效,可用于客户测试)

说明:oaid是msa sdk集成后方能获取的标识设备的id,该接口多用于客户测试场景。

接口定义:

 Future<String> getOaid()

参数说明:无

示例代码:
MzanalyticsMybmw.getOaid()  

说明:用于统计点击秒针分析广告后吊起app的行为数据。

 接口定义:
 static Future<void> onDeepLinkReceived(String url)     

参数说明:

参数 类型 说明
url String deeplink跳转后收到的url(必填)
 示例代码:      
//deeplink      
  MzanalyticsMybmw.onDeepLinkReceived(url);          

url示例:

mltsite://event/page/view/last?name=ceshi&age=30&mz_ca=2220134&mz_sp=35790   

格式规范:
scheme://host/path?key1=value1&key2=value2&mz_ca=2220134&mz_sp=35790 说明:
1、问号?前面客户可以自己定义;
2、问号后面key和value连接必须用=,不同key-value拼接必须用&;
3、同时存在mz_ca和mz_sp归为deeplink流量,否则归为普通流量;
4、mz_ca合法是7位,mz_sp合法是5位。

1.9 SDKConfig权限配置(根据业务需求自行配置)

项目中 sdkconfig.xml是开关配置文件。为 idfa、imei、oaid(可选项,如需获取按移动安全联盟推荐的方式集成MSA SDK即可)、adid、autotrackpage配置开关。

  • 当设置isRequired字段的value,字段取值为true时,开启获取;
  • 当设置isRequired字段的value,字段取值为false时,不获取;
  • 当需要页面自动监听时,请将autotrackpage的值设置为false,需要页面自动监听时,将值设置为true;
  • 当需要页面自动监听,但某些页面不需要自定动监听时,修改manualtrackpage对应的value为其页面标题,设定后会自动过滤这些页面的自动监听,若有多个页面不需要自动监听,则在value部分输入多个页面标题即可,多个页面标题之间用“、”分隔。

注意:在填写不需要自定动监听的页面标题时,页面标题中不可含有中文输入法下的“、”,否则会引起过滤不正确的情况。

3.0 页面监听上报(可选,可与1.2页面监测二选一) #

要使用navigatorObservers方法来监听页面,实现自动上报。
说明: 必须在 sdkconfig.xml是开关配置文件中的值设置为true。

3.1 注册页面监听

首先需要在启动页的`main.dart`中的主`Widget build(BuildContext context)`方法中按如下添加观察者对象方法`MZNavigationHistoryObserver()`。

示例如下:
@override
  Widget build(BuildContext context) {

    return new MaterialApp(
      debugShowCheckedModeBanner: false,
      title: "test",
      theme: ThemeData(
        primaryColor: Color(0xff303030),
        scaffoldBackgroundColor: Color(0xffebebeb),
        cardColor: Color(0xff393a3f)
      ),
      routes: routeTable,
      home: LoadingPage(),
      navigatorObservers:[MZNavigationHistoryObserver()],
       
      
    );
  }

3.2 页面跳转示例代码:

在App中需要监听跳转页面title的`Navigator.of`方法中需传入对应的name参数, name即为需要采集的title名称。 
示例方法1:

Navigator.of(_ctx).push(MaterialPageRoute(settings: RouteSettings(name: "$pageTitle"), builder: (_ctx) => page));
示例方法2:

Navigator.of(_ctx).pushNamed("$page");

3.3 设置自定义维度和自定义指标的相关方法(可选)

3.3.1 设置自定义维度cd

说明:如果需要在用户每一个触发的页面、自定义事件、高级事件中携带某个维度,调用该api实现上述三类事件中携带全局自定义维度cd。
作用域: 仅在单次的app生命周期中生效。

 接口定义:

  Future<void> setCd(String cdKey, String cdValue)

参数说明:

参数 类型 说明 是否必填
cdKey[1~25] String 自定义事件维度key( 取值范围cd[1-25] ) 必填
cdValue[1~25] String 自定义事件指标value 必填
示例代码:

try {
 MzanalyticsMybmw.setCd("cd1", "cd1value");
} on PlatformException {}
3.3.2 设置自定义指标cm

说明:如果需要在用户每一个触发的页面、自定义事件、高级事件中携带某个指标,调用该api实现上述三类事件中携带全局自定义指标cm。
作用域: 仅在单次的app生命周期中生效。

接口定义:

  Future<void> setCm(String cmKey, String cmValue)

参数说明:

参数 类型 说明 是否必填
cmKey[1~25] String 自定义事件指标key( 取值范围:cm[1-25] ) 必填
cmValue[1~25] String 自定义事件指标value 必填
示例代码:

try {
  MzanalyticsMybmw.setCm("cm1", "cm1value");
} on PlatformException {}
3.3.3 删除App缓存中的自定义维度cd

说明:调用该接口删除app缓存中的自定义维度cd1~25。

接口定义:

  Future<void> deleteCd(var cdKey)    

参数说明:

参数 类型 说明 是否必填
cdkey[1~25] String 自定义事件指标key( 取值范围:cd[1-25] ) 必填
示例代码:

try {
  MzanalyticsMybmw. deleteCd("cd1");
} on PlatformException {}
3.3.4 删除App缓存中的自定义维度cm

说明:调用该接口删除app缓存中的自定义指标cm1~25。

接口定义:

  Future<void> deleteCm(var cmKey)    

参数说明:

参数 类型 说明 是否必填
cmKey[1~25] String 自定义事件指标key( 取值范围:cm[1-25] ) 必填
示例代码:

try {
  MzanalyticsMybmw.deleteCm("cm1");
} on PlatformException {}
3.3.5 获取自定义维度cd和自定义指标cm集合

说明:调用该接口获取app缓存中的自定义维度cd和自定义指标cm。

接口定义:

Future<Map> getCdAndCm()    


示例代码:

try {
   Map map = MzanalyticsMybmw.getCdAndCm();
} on PlatformException {}

MZAnalysis SDK Deployment Guide (Flutter Test Version) #

A mzanalytics_mybmw flutter plugin project.

FirstPart:preparation 🍭 #

1. Version restrictions #

  • Flutter SDK: '>=1.17.0'.
  • Xcode version: '>=12.0'

MZAnalytics_ iOS _SDK applies to iOS 9-iOS 14.0, please set the iOS Deployment Target to iOS 9.0.

MZAnalyticsAndroidSDK is suitable for Android 2.3.3 (API Level 10) and above devices.

Advices:

It is recommended that SDK initialization method be executed after obtaining device ID, storage and other permissions. If SDK initialization method is placed before authorization, the accuracy of activation attribution and other data may be affected.


2. Add dependencies to Flutter project #

Add 'mzanalytics_myBMW' to the 'pubspec.yaml' reference.

dependencies: mzanalytics_mybmw: ^${latestVersion}

Run 'Flutter Pub Get' in the Flutter project


3. Integration preparation #

3.1 Request an AppID for your application

Create an app in the https://tongji.cn.miaozhen.com, You get a random string of numeric IDs starting with "DC -" that uniquely identify one of your applications.

3.2 AppID specification

The AppID is the unique identifier for application tracking and is captured within the site information.

3.3 The Android SDK needs to obtain the configuration of OAID

Note: It can be configured according to the individual needs of customers. If configured, the second hand analysis SDK can collect OAID information; If not configured, OAID information cannot be collected. Please introduce the MSA SDK integration method recommended by the Mobile Security Alliance official website. Mobile Security Alliance website link: <https://msa-alliance.cn/col.jsp? id=120>

3.4 Android SDK permission configuration #

Customers with the following permissions can configure as needed

Permission Permission description Optional Impact of non-authorization
INTERNET Allow program networking Required SDK cannot send data
ACCESS_NETWORK_STATE Allow detection of network connection status Optional SDK does not detect network status, directly sends data
READ_PHONE_STATE Allow access to the unique identification information of the mobile device Optional SDK cannot obtain the device ID
ACCESS_WIFI_STATE Allow to read WiFi status changes Optional Affect the data sending frequency of the data SDK
READ_EXTERNAL_STORAGE Allow to read the data stored on the SD card Required option Affects the SDK to read the CID of the unique user and the historical data of the sending failure
WRITE_EXTERNAL_STORAGE Allows writing information such as the CID of the unique user to the SD card Required option Affects the SDK storage of the CID of the unique user and the writing of failed data
Sample code:

 <! -- Network permissions -->
 <uses-permission android:name="android.permission.INTERNET" />
 <! -- network status related permissions -->
 <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
 <uses-permission android:name="android.permission.ACCESS_WIFI_STATE" />
 <! -- Relevant rights of mobile phone information -->
 <uses-permission android:name="android.permission.READ_PHONE_STATE" />
 <! SD card read/write privileges -->
 <uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
 <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />

4. Run environment configuration #

4.1 Configuration of iOS runtime environment

A. CD to the IOS project directory. B. Terminal executes' pod install '. C. Open 'Runner. Xcworkspace' in 'pod-> development-bbb>analytics_mybmw->.> ->Classes Find sdkconfig. XML 'in ->Classes and drag it into project Runner.

4.2 Configuration of Android runtime environment

A. Go to the Android project directory 'app/ SRC /main'. B. Copy the assets folder (including sdkconfig.xml and supplierconfig.json) to 'main'. C. Add attributes in the application tag (AppKey is a pure number) :



SecondPart: MZAnalysis SDK usage #

Introducing header files in flutter code:

import'package:mzanalytics_mybmw/mzanalytics_mybmw.dart';

1. Call example #

1.1 Initialize SDK (must be buried)

When using, replace xxxx with the actual AppId (Android needs to be configured in the application tag)

Interface definition:

 Future<void> appid(String aid)

Parameter Description:

Parameters Type Description
aid String The site id when the site is created is your AppId.
Sample code:
//Create an application in the https://tongji.cn.miaozhen.com website, the site id is dc-2814; pass 2814 into the interface

MzanalyticsMybmw.appid("2814");

1.2 Page monitoring (buried points are optional, and the page automatic monitoring program can choose one to achieve monitoring page browsing)

Description: Used to collect page browsing events. After adding the following code to the page startup method that needs to be monitored, the user's page browsing behavior can be collected.

Interface definition:

Future<void> trackPageView(Map parameter)

Parameter Description:

Parameter Type Description Is it required
dt String Page name Required

Description of custom parameters to be passed in customDimMetrics:

Parameter Type Description Required
cd[1~25] String Custom dimension Optional
cm[1~25] String Custom Index Optional
Sample code without passing custom dimensions and metrics:
MzanalyticsMybmw.trackPageView({"dt": "Home"});


Sample code for passing custom dimensions and metrics:
MzanalyticsMybmw.trackPageView({
                   "dt": "Home",
                 'CustomDimMetrics': {
                   "cd1": "Account Name",
                   "cm1": "Quantity 1"
                 }
});

1.3 Custom event (optional buried point)

Note: The interaction between the user and the App can be counted by adding custom event codes. In the click method of buttons or other controls that need to be customized, add the following code.

Interface definition:

Future<void> trackEvent(Map parameter)

Parameter Description:

| Parameter | Type | Description | Is it required | | ------------- | --------- | ---------------- |-------- -| | ec | String | Event category |Required | | ea | String | Event Action | Optional | | el | String | Event Label | Optional | | ev | String | Event value | Optional |

Description of custom parameters to be passed in customDimMetrics:

Parameter Type Description Required
cd[1~25] String Custom dimension Optional
cm[1~25] String Custom Index Optional
 Sample code without passing custom dimensions and metrics:
MzanalyticsMybmw.trackEvent({
               "ec":'click hot banner',
               "ea":'Click',
               "el":'click',
               "ev": '0'
             });
             
Sample code for passing custom dimensions and metrics:
MzanalyticsMybmw.trackEvent({
                   "ec":'click hot banner',
               "ea":'Click',
               "el":'click',
              "ev": '0',
                 'CustomDimMetrics': {
                   "cd1": "Account Name",
                   "cm1": "Quantity 1"
                 }
                 });

1.4 Advanced custom event (optional buried point)

Description: The advanced event statistics code can count user interaction events with more dimensions and indicators. Users can set the dimensions and indicators to be counted according to statistical business needs.

Interface definition:

Future<void> trackSiteCustomEvent(Map parameter)

Parameter Description:

Parameter Type Description Required
customEvent Map Contains advanced event id, advanced event dimensions, and the number of indicators are subject to the actual advanced event created in the system Required
customDimMetrics Map Custom dimensions and metrics Optional, if there are no custom dimensions and custom metrics, customDimMetrics may not be passed

Description of advanced event parameters to be passed in CustomEvent:

Parameter Type Description Required
caid String Advanced event id Required
cal[1~20] String Advanced event dimension Optional
cav[1~20] String Advanced event indicators Optional

Description of custom parameters to be passed in customDimMetrics:

Parameter Type Description Required
cd[1~25] String Custom dimension Optional
cm[1~25] String Custom Index Optional
 Sample code without passing custom dimensions and metrics:
 MzanalyticsMybmw.trackSiteCustomEvent({
                 'CustomEvent': {
                   "caid": "1",
                   "cal1": "2020/01/10",
                   "cal2": "15728749249",
                   "cal3": "Beijing",
                   "cav1": "2"
                 }
               });


Sample code for passing custom dimensions and metrics:
 MzanalyticsMybmw.trackSiteCustomEvent({
                 'CustomEvent': {
                   "caid": "1",
                   "cal1": "2020/01/10",
                   "cal2": "15728749249",
                   "cal3": "Beijing",
                   "cav1": "2"
                 },
                 'CustomDimMetrics': {
                   "cd1": "Click on Credit Card",
                   "cd2": "View product details",
                   "cm1": "Click the total number of credit card users",
                   "cm2": "The total number of users who view product details"
                 }
               });

Remarks:

The advanced event ID must be passed. There are 20 cals at most, and the names are cal1~20. There are 20 cavs at most, and the names are cav1~20. There are 25 cds at most, and the names are cd1~25. There are 25 cm at most, and the names are cm1~25.

In actual use, replace advanced event dimensions, advanced event indicators, custom dimensions, and custom indicators with actual return values.

1.5 Pulse event (optional buried point)

Note: This event can be buried when the user exits the App or page, and used to calculate more accurate App usage time.

Interface definition:

 Future<void> trackPulse()

Parameter description: None

Sample code:

 MzanalyticsMybmw.trackPulse();

1.6 Get visitor id (device unique ID, used for customer testing)

Note: The visitor id is the id of the unique user identified by Miaozhen analysis. This interface is mostly used in customer test scenarios.

Interface definition:

  Future<String> getCid()

Parameter description: None

Sample code:

 MzanalyticsMybmw.getCid();

1.7 Get oaid (only valid for Android, used for customer testing)

Note: oaid is the ID of the identification device that can be obtained after the msa sdk is integrated. This interface is mostly used in customer test scenarios.

Interface definition:

 Future<String> getOaid()

Parameter description: none

Sample code:
MzanalyticsMybmw.getOaid()

Description: Used to count the behavior data of lifting the app after clicking on the second hand to analyze the advertisement.

  Interface definition:
  static Future<void> onDeepLinkReceived(String url)

Parameter Description:

Parameters Type Description
url String URL received after deeplink redirection (required)
  Sample code:
//deeplink
   MzanalyticsMybmw.onDeepLinkReceived(url);

url example:

 mltsite://event/page/view/last?name=ceshi&age=30&mz_ca=2220134&mz_sp=35790

Format specification:
scheme://host/path?key1=value1&key2=value2&mz_ca=2220134&mz_sp=35790
Description:
1. Question mark? Customers can define by themselves in front;
2. After the question mark, the key and value must be connected with =, and the different key-value must be connected with &;
3. Both mz_ca and mz_sp are classified as deeplink traffic, otherwise they are classified as ordinary traffic;
4. The legal mz_ca is 7 digits, and the legal mz_sp is 5 digits.

1.9 SDKConfig permission configuration (configure yourself according to business needs)

The sdkconfig.xml in the project is the switch configuration file. Configure the switches for idfa, imei, oaid (optional, if you need to obtain the MSA SDK as recommended by the Mobile Security Alliance), adid, and autotrackpage configuration switches.

  • When the value of the isRequired field is set, and the field value is true, the acquisition is enabled;
  • When the value of the isRequired field is set and the value of the field is false, it is not obtained;
  • When you need to automatically monitor the page, please set the value of autotrackpage to false, and when you need to automatically monitor the page, set the value to true;
  • When the page needs to be automatically monitored, but some pages do not need to be automatically monitored, modify the value corresponding to the manualtrackpage to be the page title. After setting, the monitoring of these pages will be automatically filtered. If there are multiple pages, automatic monitoring is not required Just enter multiple page titles in the value section, and separate multiple page titles with ",".

Note: When filling in the page title that does not need to be automatically monitored, the page title must not contain the "," under the Chinese input method, otherwise it will cause incorrect filtering.

3. page monitoring report (optional, can choose one of the two with 1.2 page monitoring) #

Use the navigatorObservers method to monitor the page and realize automatic reporting. Note: The value in the sdkconfig.xml switch configuration file must be set to true.

3.1 Registration page monitoring

First, you need to add the observer object method `MZNavigationHistoryObserver()` in the main `Widget build(BuildContext context)` method in the `main.dart` of the startup page as follows.

Examples are as follows:
@override
  Widget build(BuildContext context) {

    return new MaterialApp(
      debugShowCheckedModeBanner: false,
      title: "test",
      theme: ThemeData(
        primaryColor: Color(0xff303030),
        scaffoldBackgroundColor: Color(0xffebebeb),
        cardColor: Color(0xff393a3f)
      ),
      routes: routeTable,
      home: LoadingPage(),
      navigatorObservers:[MZNavigationHistoryObserver()],
       
      
    );
  }

3.2 Page jump sample code:

The `Navigator.of` method that needs to monitor the title of the jump page in the App needs to pass in the corresponding name parameter, and name is the name of the title to be collected.
Example method 1:

Navigator.of(_ctx).push(MaterialPageRoute(settings: RouteSettings(name: "$pageTitle"), builder: (_ctx) => page));
Example method 2:

Navigator.of(_ctx).pushNamed("$page");
3.3.1 Set custom dimension cd

Note: If you need to carry a certain dimension in each triggered page, custom event, and advanced event of the user, call this api to carry the global custom dimension cd in the above three types of events. Scope: Only effective in a single app life cycle.

 Interface definition:

  Future<void> setCd(String cdKey, String cdValue)

Parameter Description:

Parameter Type Description Required
cdKey[1~25] String Custom event dimension key (value range cd[1-25]) Required
cdValue[1~25] String Custom event indicator value Required
Sample code:

try {
 MzanalyticsMybmw.setCd("cd1", "cd1value");
} on PlatformException {}
3.3.2 Setting custom indicators cm

Note: If you need to carry a certain indicator in each triggered page, custom event, and advanced event of the user, call this api to carry the global custom indicator cm in the above three types of events. Scope: Only effective in a single app life cycle.

Interface definition:

  Future<void> setCm(String cmKey, String cmValue)

Parameter Description:

Parameter Type Description Required
cmKey[1~25] String Custom event indicator key (value range: cm[1-25]) required
cmValue[1~25] String Custom event indicator value Required
Sample code:

try {
  MzanalyticsMybmw.setCm("cm1", "cm1value");
} on PlatformException {}
3.3.3 Delete the custom dimension cd in the App cache

Description: Call this interface to delete the custom dimensions cd1~25 in the app cache.

Interface definition:

  Future<void> deleteCd(var cdKey)

Parameter Description:

Parameter Type Description Required
cdkey[1~25] String Custom event indicator key (value range: cd[1-25]) Required
Sample code:

try {
  MzanalyticsMybmw. deleteCd("cd1");
} on PlatformException {}
3.3.4 Delete the custom dimension cm in the App cache

Description: Call this interface to delete the custom indicators cm1~25 in the app cache.

Interface definition:

  Future<void> deleteCm(var cmKey)

Parameter Description:

Parameter Type Description Required
cmKey[1~25] String Custom event indicator key (value range: cm[1-25]) required
 Sample code:

 try {
   MzanalyticsMybmw.deleteCm("cm1");
 } on PlatformException {}
3.3.5 Get custom dimension cd and custom indicator cm collection

Description: Call this interface to get the custom dimension cd and custom indicator cm in the app cache.

Interface definition:

 Future<Map> getCdAndCm()


 Sample code:

 try {
    Map map = MzanalyticsMybmw.getCdAndCm();
 } on PlatformException {}
1
likes
0
pub points
0%
popularity

Publisher

unverified uploader

One for BMW Group to use flutter plug-in, data collection and analysis.

Homepage

License

unknown (LICENSE)

Dependencies

built_collection, flutter

More

Packages that depend on mzanalytics_mybmw