npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

cordova-plugin-dmhub

v2.0.8

Published

Cordova Plugin for DMHub SDK

Downloads

12

Readme

DMHub cordova plugin

安装步骤

cordova plugin add cordova-plugin-dmhub

配置

Android

打开 platforms/android/app/src/main/AndroidManifest.xml 修改

<meta-data android:name="com.convertlab.dmhubsdk.config.DMHubSDKAppId" android:value="[配置appid]" />
<meta-data android:name="com.convertlab.dmhubsdk.config.Endpoint" android:value="[配置服务器地址]" />
<meta-data android:name="com.convertlab.dmhubsdk.config.EnableDebugLogging" android:comment="是否启用调试,默认false"  android:value="false"/>
<meta-data android:name="com.convertlab.dmhubsdk.config.FlushInterval" android:comment="上传数据的时间间隔(单位:秒),默认值:30000ms" android:value="30000"/>
<meta-data android:name="com.convertlab.dmhubsdk.config.BulkUploadLimit" android:comment="事件队列长度,默认是40"  android:value="40"/>
<meta-data android:name="com.convertlab.dmhubsdk.config.UploadOnlyWifi" android:comment="是否自动记录进入、离开视图事件,默认值:" android:value="false"/>
<meta-data android:name="com.convertlab.dmhubsdk.config.MaximumBackgroundDuration" android:comment="App退到后台,重新打开,被认为重新开启的阈值,默认30000ms" android:value="30000"/>

第二行到第七行,如果无需配置,可以采用默认值,建议删除。

iOS

打开Staging/config.xml

修改appid,以及endpoint配置服务器地址

<preference name="DMHUB_SDK_APP_ID" value="[配置appid]" />
<preference name="DMHUB_SDK_ENDPOINT" value="[配置服务器地址]" />
<preference name="DMHUB_SDK_AUTO_TRACK" value="YES" />
<preference name="DMHUB_SDK_FLUSH_INTERVAL" value="60"/>

如果不需要配置服务器地址,则删除第二行 如果不需要自动埋点,则删除第三行 如果不需要调整默认30秒的埋点刷新时间,则删除第四行

调用方式

1. 启动SDK

接口

DMHubCDVPlugin.initSdk()

2. 设置客户身份

接口

DMHubCDVPlugin.setIdentity(identityType: string, identityValue: string);

例子

DMHubCDVPlugin.setIdentity('email', '[email protected]');

3. 获取当前客户身份

接口

DMHubCDVPlugin.currentIdentity(success: function, failed: function);

例子

DMHubCDVPlugin.currentIdentity(function(result){
    if(result){
        document.getElementById('identity').innerText = result.type + ' ' + result.value;
    }else{
        document.getElementById('identity').innerText = '';
    }
}, function (result) {
    document.getElementById('identity').innerText = '';
});

4. 清除客户身份

接口

DMHubCDVPlugin.clearIdentity()

5. 跟踪自定义客户事件

接口

DMHubCDVPlugin.trackMap(eventId: string, properties: object);

例子

DMHubCDVPlugin.trackMap('add-to-cart', {
            'name': 'juice',
            'price': 12.00
        });

6. 跟踪自定义客户事件

接口

DMHubCDVPlugin.trackMap(eventId: string);

例子

DMHubCDVPlugin.track('add-to-cart');

7. 跟踪进入视图事件

接口

DMHubCDVPlugin.trackOpenView(viewName: string);

例子

DMHubCDVPlugin.trackOpenView('menuPage');

8. 跟踪离开视图事件

接口

DMHubCDVPlugin.trackExitView(viewName: string);

例子

DMHubCDVPlugin.trackExitView('productPage');

9. 禁用采集信息行为

默认以下所有信息将进行采集,可支持配置选项有: android:

  • imei
  • bluetooth
  • mac
  • location
  • androidId

iOS:

  • idfa
  • location

注意:同一个配置项将同时影响 iOS、Android 两端

接口

DMHubCDVPlugin.disableCollect(names: Array<string>);

例子

DMHubCDVPlugin.disableCollect(['imei','idfs','location']);

10. 启用采集信息行为

默认以下所有信息将进行采集,不需要进行启用: android:

  • imei
  • bluetooth
  • mac
  • location
  • androidId

iOS:

  • idfa
  • location

注意:同一个配置项将同时影响 iOS、Android 两端

接口

DMHubCDVPlugin.enableCollect(names: Array<string>);

例子

DMHubCDVPlugin.enableCollect(['imei','idfs','location']);

Supported Platforms

  • Android
  • iOS