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-umeng-analytics

v1.0.2

Published

Cordova Umeng Analytics Plugin.

Downloads

7

Readme

友盟移动统计 Cordova 插件

平台

  • iOS
  • Android

安装

cordova plugin add cordova-plugin-umeng-analytics

配置 App ID

config.xml 中配置以下内容。

<!-- iOS -->
<platform name="ios">
    <preference name="CDVUmengAnalyticsAppKey" value="YOUR_UMENG_IOS_APP_ID"/>
    <preference name="ChannelId" value="YOUR_UMENG_IOS_CHANNEL_ID"/>
</platform>

<!-- Android -->
<platform name="android">
    <preference name="CDVUmengAnalyticsAppKey" value="YOUR_UMENG_ANDROID_APP_ID"/>
    <preference name="ChannelId" value="YOUR_UMENG_ANDROID_CHANNEL_ID"/>
</platform>

使用

当成功安装和配置完成后,您可以通过全局变量 UmengAnalytics 来调用友盟统计相关方法。

自定义事件统计

/**
 * @param {string} eventId - 自定义事件 ID。
 */
UmengAnalytics.onEvent(eventId)

/**
 * @param {string} eventId - 自定义事件 ID。
 * @param {string} label - 分类标签。不同的标签会分别进行统计,方便同一事件的不同标签的对比,为 `nil` 或空字符串时后台会生成和 `eventId` 同的标签。
 */
UmengAnalytics.onEventWithLabel(eventId, label)

/**
 * @param {string} eventId - 自定义事件 ID。
 * @param {Object<string, string>} attributes - 属性中的 key/value 必须为 `String` 类型, 每个应用至多添加 500 个自定义事件,key 不能超过100个 。
 */
UmengAnalytics.onEventWithParameters(eventId, attributes)

/**
 * @param {string} eventId - 自定义事件 ID。
 * @param {Object<string, string>} attributes - 属性中的 key/value 必须为String类型, 每个应用至多添加 500 个自定义事件,key 不能超过 100 个。
 * @param {Number} counter - 自定义数值。
 */
UmengAnalytics.onEventWithCounter(eventId, attributes, counter)

页面访问统计

必须配对调用 onPageBeginonPageEnd 两个方法来完成自动统计,若只调用某一个方法不会生成有效数据;在该页面展示时调用 onPageBegin,当退出该页面时调用 onPageEnd

/**
 * @param {string} pageName - 统计的页面名称。
 */
UmengAnalytics.onPageBegin(pageName)

/**
 * @param {string} pageName - 统计的页面名称。
 */
UmengAnalytics.onPageEnd(pageName)

账号统计

统计用户时以设备为标准,如果需要统计应用自身的账号,可以使用此功能。

/**
 * @param {string} userId - 用户 ID。
 * @param {string=} provider - 可选。不能以下划线 `_` 开头,使用大写字母和数字标识; 如果是上市公司,建议使用股票代码。
 */
UmengAnalytics.profileSignIn(userId, provider)

/**
 * 调用后,不再发送账号内容。
 */
UmengAnalytics.profileSignOff()

调试模式

/**
 * @param {boolean} enabled - 是否打开调试模式。
 */
UmengAnalytics.setLogEnabled(enabled);

获取渠道 ID

/**
 * @param {Function<string>} callback
 */
UmengAnalytics.getChannelId(callback);

获取设备 ID

/**
 * @param {Function<string>} callback
 */
UmengAnalytics.getDeviceId(callback);