mzanalytics_mybmw 0.2.3 copy "mzanalytics_mybmw: ^0.2.3" to clipboard
mzanalytics_mybmw: ^0.2.3 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: ^0.2.0

在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 允许程序联网和上报监测数据。
ACCESS_NETWORK_STATE 允许检测网络连接状态,在网络异常状态下避免数据发送,节省流量和电量。
READ_PHONE_STATE 允许访问手机设备的信息,通过获取的信息来唯一标识用户。
ACCESS_WIFI_STATE 允许读取WiFi相关信息,在合适的网络环境下更新配置。
READ_EXTERNAL_STORAGE 允许读取SD卡上存储的相关ID信息 。
WRITE_EXTERNAL_STORAGE 允许写入相关ID信息到SD卡上。
示例代码:

<!-- 网络权限 -->
<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的行为数据,须在iOS的appDelegate.m页面中配置deeplink相关代码。

 接口定义:
+(void)handleOpenURL:(NSURL *)url;

参数说明:

参数 类型 说明
url NSURL 回调接收到的url (必填)
示例代码:

在AppDelegate.m的deeplink系统回调中现实本方法, 根据项目配置如下:
/**DeepLink */
-(BOOL)application:(UIApplication *)app openURL:(NSURL *)url 
    options:(NSDictionary<UIApplicationOpenURLOptionsKey,id> *)options{
     
     [MLTSiteManager  handleOpenURL:url];
      
    return YES;
    }
    
/**UniversalLinks */
-(BOOL)application:(UIApplication *)application continueUserActivity:(NSUserActivity *)userActivity restorationHandler:(nonnull void (^)(NSArray<id<UIUserActivityRestoring>> * _Nullable))restorationHandler{
      
    [MLTSiteManager handleOpenURL:userActivity.webpageURL];          
     
    return YES;
    }
    

说明:请在Android原生页面配置完成。修改AndroidManifest.xml文件。在接受deeplink唤起的activity配置中添加如下代码:

<intent-filter >
    <action android:name="android.intent.action.VIEW" />
    <category android:name="android.intent.category.DEFAULT" />
    <category android:name="android.intent.category.BROWSABLE" />
        <data
            android:host="bj"
          android:pathPrefix="/site"
          android:scheme="miaozhen" />
</intent-filter>
唤起链接说明
示例:
    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位 

Android 唤起事件Activity的onCreate()方法中初始化如下方法:

//SDK 配置相关
MzConfig config = new MzConfig();
//调试时设置log开关
config.setDebugMode(true);
//SDK初始化
MzSiteSDK mzSiteSDK =     MzSiteSDK.getInstance(getApplicationContext(),config,getIntent());

备注:如果想完整启动app,建议添加到启动页面。

2.0 SDKConfig权限配置

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

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

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

3.0 页面监听上报 #

要使用`navigatorObservers`方法来监听页面,实现自动上报。

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 cd_key, String cd_value)

参数说明:

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

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

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

接口定义:

  Future<void> setCm(String cm_key, String cm_value)

参数说明:

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

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

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

接口定义:

  Future<void> deleteCd(var cd_key)    

参数说明:

参数 类型 说明 是否必填
cd_key[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 cm_key)    

参数说明:

参数 类型 说明 是否必填
cm_key[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 {}

Second-Hand Analysis SDK Deployment Guide (Flutter Test Version) #

A mzanalytics_mybmw flutter plugin project.

1, 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.

# # advice: #

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: ^ 0.2.0

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 #

General permissions:

Permissions | | | purposes | -------------------- | ---------------------------------- | | | INTERNET allows programs to networking and report the monitoring data. | | ACCESS_NETWORK_STATE | allows detection network connection state, under the abnormal state to avoid network data to send, save flow and power. | | READ_PHONE_STATE | allows access to information of mobile equipment, uniquely identifies the user through the information. | | ACCESS_WIFI_STATE | allowed to read the information on WiFi, at the right under the network environment to update the configuration. | | READ_EXTERNAL_STORAGE | allows read SD card to store relevant ID information. | | WRITE_EXTERNAL_STORAGE | write enable relevant ID information to SD card. |

` Sample code:

<! -- Network permissions -->

`


  1. 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) :



Second, second hand analysis of SDK use

Flutter code introduces header files:

import 'package:mzanalytics_mybmw/mzanalytics_mybmw.dart';

# 1 #

1.1 Initialize the SDK (must be buried)

Replace XXXX with the actual AppId (Android needs to be configured in the application TAB)

Interface definition:

Future

Parameter description:

| | | | type parameters | ----- | -------- | ------ | | aid | String | create site website id for your AppId. |

Sample code: / / create an app in the https://tongji.cn.miaozhen.com, the site id is dc - 2814; Pass 2814 into the interface

MzanalyticsMybmw.appid("2814");

1.2 Page monitoring (optional burial point)

Description: Used to collect page browsing events. After the following code is added to the page startup method to be monitored, the page browsing behavior of users can be collected.

Interface definition:

Future

Parameter description:

parameters type if required
dt String required page names

Description of custom parameters to be passed in customDimMetrics:

parameters type if required
CD [1 ~ 25] String
cm [1 ~ 25] String custom indicators optional

Example code for not passing in custom dimensions and metrics: MzanalyticsMybmw. TrackPageView ({" dt ":" home page "});

Sample code for passing custom dimensions and metrics: MzanalyticsMybmw.trackPageView({ "Dt ":" home page ", 'CustomDimMetrics': { "Cd1 ":" account name ", "Cm1 ":" Quantity 1" } });

1.3 Custom events (optional burial point)

Note: user and APP interaction action, can add custom event code for statistics, in the need to customize the buried button or other controls click method, add the following code.

Interface definition:

Future

Parameter description:

parameters type if required
ec String classification required
ea String action events optional
el String tags events optional
ev String value events optional

Description of custom parameters to be passed in customDimMetrics:

parameters type if required
CD [1 ~ 25] String
cm [1 ~ 25] String custom indicators optional

Example code for not passing in custom dimensions and metrics: MzanalyticsMybmw.trackEvent({ "EC ": 'Click on hot baggage banner', "ea": 'Click', "El ": 'click ', "ev": '0' });

Sample code for passing custom dimensions and metrics: MzanalyticsMybmw.trackEvent({ "EC ": 'Click on hot baggage banner', "ea": 'Click', "El ": 'click ', "ev": '0', 'CustomDimMetrics': { "Cd1 ":" account name ", "Cm1 ":" Quantity 1" } });

1.4 Advanced custom events (optional burial point)

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

Interface definition:

Future

Parameter description:

parameters type if required
customEvent Map for contains advanced event id, as well as advanced event dimension, the number of indicators are in real in the system to create the advanced event
customDimMetrics Map for optional custom dimensions and indicators, there is no custom dimensions and custom indicators, customDimMetrics don't

Description of advanced event parameters to be passed in the CustomEvent:

parameters type if required
caid String id required
CAL [1 ~ 20] String advanced event dimension optional
[1 ~ 20] of cav String index

Description of custom parameters to be passed in customDimMetrics:

parameters type if required
CD [1 ~ 25] String
cm [1 ~ 25] String custom indicators optional

Example code for not passing in 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 credit card ", "CD2 ":" View product details ", "Cm1 ":" Total number of credit card clicks ", "Cm2 ":" Total number of users to view product details" } });

Remark:

The high-level event ID must be passed. There are up to 20 CALS with the names CAL1 to 20. There are up to 20 CAVs, named CAV1 ~20. There are up to 25 CDs with names of CD1 ~25. There are up to 25 CMs with names of CM1 ~25.

In actual use, the advanced event dimension, advanced event metric, custom dimension, custom metric are replaced with the actual return value.

1.5 heartbeat event (optional burial point)

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

Interface definition:

Future

Parameter description: none

Sample code:

MzanalyticsMybmw.trackPulse();

1.6 Obtain visitor ID (unique device ID)

Note: Visitor ID is the ID of the second hand analysis identification unique user. This interface is mostly used in customer test scenarios.

Interface definition:

Future

Parameter description: none

Sample code:

MzanalyticsMybmw.getCid();

1.7 Obtain OAID (Android only)

Description: OAID is the ID that can be obtained after MSA SDK integration to identify the device. This interface is mostly used in customer test scenarios.

Interface definition:

Future

Parameter description: none

Sample code: MzanalyticsMybmw.getOaid()

Note: To count the behavior data of lifting the app after clicking the second hand to analyze the AD, you must configure the Deeplink related code in the iOS AppDelegate. m page.

Interface definition: +(void)handleOpenURL:(NSURL *)url;

Parameter description:

| | | | type parameters | ----- | -------- | -------------------- | | | url NSURL | receives a callback url | (required)

Sample code:

Realize this method in the AppDelegate.m deeplink system callback, as configured by the project:

` /**DeepLink */ -(BOOL)application:(UIApplication *)app openURL:(NSURL *)url options:(NSDictionary<UIApplicationOpenURLOptionsKey,id> *)options{

[MLTSiteManager handleOpenURL:url];

return YES; }

/**UniversalLinks */ -(BOOL)application:(UIApplication *)application continueUserActivity:(NSUserActivity *)userActivity restorationHandler:(nonnull void (^)(NSArray<id

[MLTSiteManager handleOpenURL:userActivity.webpageURL];

return YES; }

`

Note: Please complete the configuration on the Android native page. Modify the AndroidManifest.xml file. Add the following code to the activity configuration that is evocated by Deeplink:

<intent-filter > <action android:name="android.intent.action.VIEW" /> <category android:name="android.intent.category.DEFAULT" /> <category android:name="android.intent.category.BROWSABLE" /> <data android:host="bj" android:pathPrefix="/site" android:scheme="miaozhen" /> </intent-filter>

` 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? The former can be defined by the customer
  2. After the question mark, key and value must be joined with =, and different key-value splices must be joined with & 3, the existence of MZ_CA and MZ_SP is classified as Deeplink traffic, otherwise it is classified as ordinary traffic 4, MZ_CA is 7 bits, MZ_SP is 5 bits `

Android calls the event Activity onCreate() method to initialize the following method:

//SDK configuration related MzConfig config = new MzConfig(); // Set the log switch during debugging config.setDebugMode(true); / / SDK initialization MzSiteSDK mzSiteSDK = MzSiteSDK.getInstance(getApplicationContext(),config,getIntent());

Note: If you want to launch the app completely, it is recommended to add it to the launch page.

2.0 SDKConfig permission configuration

The sdkconfig.xml in the project is the switch configuration file. Configure switches for IDFA, IMEI, OAID, ADID, AutoTrackPage.

  • When the value of isRequired field is set to true, access is enabled;
  • When the value of the isRequired field is set to false, the value is not obtained.
  • When you need to configure the list of pages that do not need custom monitoring, change the corresponding value of ManualTrackPage to its page title. After setting, the monitoring of these pages will be automatically filtered. If there are multiple pages that do not need automatic monitoring, multiple page titles can be entered in the value section, and the titles of multiple pages are separated by "and".

Note: when filling in the title of the page which does not need self-positioning monitoring, the title of the page should not contain the ", "under the Chinese input method, otherwise it will cause incorrect filtering.

3.0 page listens for reports #

You should use the 'navigatorObservers' method to listen to pages for automatic reporting.

3.1. Register for page listening

. First of all need to start page main dart the main Widget build (BuildContext context) method according to the following add observer object method MZNavigationHistoryObserver ().

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:

In the App, the corresponding name parameter should be passed into the 'navigator. of' method that needs to listen for the title of the jump page. Name is the title name to be collected.

` Example method 1:

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

` Sample method 2:

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

3.3 Methods for setting custom dimensions and custom metrics

3.3.1 Set up the custom dimension CD

Note: If you need to carry a dimension in each page, custom event and advanced event triggered by the user, call this API to carry a global custom dimension CD in the above three types of events. Scope: Only takes effect during a single app life cycle.

Interface definition:

Future

Parameter description:

parameters type if required
cd_key [1 ~ 25] String custom dimension key events (scope CD / 1-25)
cd_value [1 ~ 25] String custom event index value fill

Sample code:

try { MzanalyticsMybmw.setCd("cd1", "cd1value"); } on PlatformException {}

3.3.2 Set the custom metric CM

Note: If you need to carry a metric in each triggered page, custom event and high-level event, call this API to carry a global custom metric CM in the above three types of events. Scope: Only takes effect during a single app life cycle.

Interface definition:

Future

Parameter description:

parameters type if required
cm_key [1 ~ 25] String custom event index key (range: cm / 1-25)
cm_value [1 ~ 25] String custom event index value fill

Sample code:

try { MzanalyticsMybmw.setCm("cm1", "cm1value"); } on PlatformException {}

3.3.3 Delete the custom dimension CD from the App cache

Note: Call this interface to delete the custom dimension CD1 ~25 from the APP cache.

Interface definition:

Future

Parameter description:

parameters type if required
cd_key [1 ~ 25] String custom event index key (range: CD / 1-25)

Sample code:

try { MzanalyticsMybmw. deleteCd("cd1"); } on PlatformException {}

3.3.4 Delete the custom dimension CM in the APP cache

Note: Call this interface to delete the custom metrics cm1~25 from the app cache.

Interface definition:

Future

Parameter description:

parameters type if required
cm_key [1 ~ 25] String custom event index key (range: cm / 1-25)

Sample code:

try { MzanalyticsMybmw.deleteCm("cm1"); } on PlatformException {}

3.3.5 Get custom dimension CD and custom metric CM collection

Note: Call this interface to get the custom dimension CD and the custom metric CM in the APP cache.

Interface definition:

Future

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