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-aliyun-emas

v0.0.1-alpha.1

Published

this is ali emas cordova plugin

Downloads

5

Readme

cordova-plugin-aliyun-emas

使用阿里云移动研发平台EMAS服务

简介

当前实现了EMAS中的性能分析远程日志崩溃分析移动数据分析等模块

安装

cordova plugin add cordova-plugin-aliyun-emas

使用

文件配置

Cordova项目进行以下配置:的config.xml下需进行以下配置:

ios

1、将AliyunEmasServices-Info.plist放入项目根目录(与config.xml同目录) 2、config.xml添加如下配置:

<platform name="ios">
    <preference name="AliyunXNServe" value="true"/>
    <preference name="AliyunCrashServe" value="true"/>
    <preference name="AliyunTlogServe" value="true"/>
    <preference name="AliyunOpenDebug" value="true"/>
    <preference name="AliyunMobileAnalyticsServe" value="true"/>
</platform>

android

1、将aliyun-emas-services.json放入项目根目录(与config.xml同目录) 2、config.xml添加如下配置:

<platform name="android">
    <preference name="AliyunXNServe" value="true"/>
    <preference name="AliyunCrashServe" value="true"/>
    <preference name="AliyunTlogServe" value="true"/>
    <preference name="AliyunOpenDebug" value="true"/>
    <preference name="AliyunMobileAnalyticsServe" value="true"/>
</platform>

这几个配置皆与自启动服务相关,如果开发者需要自动启动服务api的话,则这几项必须被设置,后续在API说明中会有详细说明,其中:

  • AliyunXNServe:是否开启性能分析服务
  • AliyunCrashServe:是否开启崩溃分析服务
  • AliyunTlogServe:是否开启远程日志服务
  • AliyunOpenDebug:是否开启debug模式
  • AliyunMobileAnalyticsServe:是否开启移动数据分析服务

具体用法

注意事项:

  • 自动启动服务api必须要在config.xml中对相关服务进行配置
  • 手动启动服务前必须先注册初始化数据

1、启动服务

启动服务分两种形式:自动启动手动启动,强烈建议使用自动启动模式

// 以下API皆在项目`deviceReady`中调用 

// -------------------------
// **自动启动服务(存在注意事项,需先配置config.xml)
// 针对(性能分析、远程日志、崩溃分析、移动数据分析)
AliyunEMAS.autoStartAliyunAnalyticsWithArgs('new_appVersion', 'new_channel', 'new_nick', (value) => {
    console.log(value);
}, (e) => {
    console.error(e)
})

// -------------------------
// **手动启动服务(性能分析、远程日志、崩溃分析)
// 初始化数据(优先执行)
AliyunEMAS.registerData('appVersion', 'channel', 'nick', success, error);

// 注册性能分析服务
AliyunEMAS.initAlicloudAPM();

// 注册远程日志服务
AliyunEMAS.initAlicloudTlog();

// 注册崩溃分析服务
AliyunEMAS.initAlicloudCrash();

// 启动服务
AliyunEMAS.start();

// -------------------------
// **手动启动服务(移动数据分析)
AliyunEMAS.autoInitManSdk();

2、远程日志

在任意需要被调用的地方直接执行

// 打印一条警告信息
AliyunEMAS.warn('警告', '这是一条warn信息');

// 打印一条错误信息
AliyunEMAS.error('错误', '这是一条error信息');

// 打印一条debug信息
AliyunEMAS.debug('Debug', '这是一条debug信息');

// 默认打印
AliyunEMAS.info('默认', '这是一条info信息');

3、自定义事件

// 自定义扩展参数,格式{key-value,...}
var params = {key4: 'value4', key5: 'value5'}
AliyunEMAS.customEventBuilder('事件名称', '页面名称', 12, params)

API说明

//////////////// 初始化EMAS ////////////////////
// --------------------------------------------
/**
 * @brief 初始化准备数据
 * @details 优先调用,否则可能会出现意想不到的bug
  @param appVersion app版本信息
  @param channel 渠道信息
  @param nick 用户昵称
  @param success 成功回调
  @param error 失败回调
 */
registerData: function (appVersion, channel, nick, success, error);

/**
 * @brief 性能监控初始化接口(自动读取appKey、appSecret)
 * @details 性能监控初始化接口,appKey、appSecret会从AliyunEmasServices-Info.plist自动读取
 */
initAlicloudAPM: function ();

/**
 * @brief 远程日志初始化接口(自动读取appKey、appSecret)
 * @details 远程日志初始化接口,appKey、appSecret会从AliyunEmasServices-Info.plist自动读取
 */
initAlicloudTlog: function ();

/**
 * @brief 崩溃分析始化接口(自动读取appKey、appSecret)
 * @details 崩溃分析初始化接口,appKey、appSecret会从AliyunEmasServices-Info.plist自动读取
 */
initAlicloudCrash: function ();

/**
 * @brief 启动AppMonitor服务
 * @details 启动AppMonitor服务,可包括崩溃分析、远程日志、性能监控
 */
start: function ();

/**
 @brief 自动启动阿里云服务:<性能分析&远程日志&崩溃分析>
 自动读取appKey、appSecret
 只需单独集成此api即可
 启动服务需在config.xml中配置,具体参照文档说明
 函数会返回失败信息,成功无返回
 @param appVersion app版本信息
 @param channel 渠道信息
 @param nick 用户昵称
 @param success 成功回调
 @param error 失败回调
 */
autoStartAliyunAnalyticsWithArgs: function (appVersion, channel, nick, success, error);

//////////////// 远程日志 log //////////////////
// --------------------------------------------
/**
 * @brief 打印一条错误日志
 */
error: function (title, msg);

/**
 * @brief 打印一条警告日志
 */
warn: function (title, msg);

/**
 * @brief 打印一条debug日志
 */
debug: function (title, msg);

/**
 * @brief 打印一条默认日志
 */
info: function (title, msg);

//////////////// 移动数据分析 ////////////////////
// --------------------------------------------

/**
 @brief 初始化移动数据分析(自动)
 如果在config.xml中配置了`AliyunMobileAnalyticsServe = true`,则无需调用该api
 */
autoInitManSdk: function ();

/**
 @brief 登录会员
 功能: 获取登录会员,然后会给每条日志添加登录会员字段
 调用时机: 登录时调用
 备注: 阿里云 平台上的登录会员 UV 指标依赖该接口
 @param userAccount 用户昵称
 @param userId 用户id
 */
userLogin: function (userAccount, userId);

/**
 @brief 注册会员
 功能: 产生一条注册会员事件日志
 调用时机: 注册时调用
 备注: 阿里云 平台上注册会员指标依赖该接口
 @param userId 用户id
 */
userRegister: function (userId);

/**
 @brief 自定义事件
 @param eventLabel 设置自定义事件标签
 @param pageName 设置自定义事件页面名称
 @param duration 设置自定义事件持续时间 单位(ms)
 @param args 设置自定义事件扩展参数 格式:{key-value,...} 可为空
 */
customEventBuilder: function (eventLabel,pageName,duration,args);