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

react-native-pure-umeng-analytics

v0.1.7

Published

react native umeng analytics

Downloads

20

Readme

react-native-pure-umeng-analytics

友盟统计

Installation

npm i react-native-pure-umeng-analytics
// 0.60 版本以下手动执行这句
react-native link react-native-pure-umeng-analytics

Setup

image

打开应用信息页面,安卓推送有 AppkeyUmeng Message Secret 两个字段,iOS 只有 Appkey 字段,后面将用这些字段初始化友盟。

iOS

修改 AppDelegate.m,如下

#import <RNTUmengAnalytics.h>

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
  ...
  // 初始化友盟基础库
  // channel 一般填 App Store,如果有测试环境,可按需填写
  // debug 表示是否打印调试信息
  [RNTUmengAnalytics init:@"appKey" channel:@"App Store" debug:false];
  [RNTUmengAnalytics analytics];
  return YES;
}

Android

android/app/build.gradle 根据不同的包填写不同的配置,如下:

buildTypes {
    debug {
        manifestPlaceholders = [
            UMENG_APP_KEY: '',
            UMENG_PUSH_SECRET: '',
            UMENG_CHANNEL: '',
        ]
    }
    release {
        manifestPlaceholders = [
            UMENG_APP_KEY: '',
            UMENG_PUSH_SECRET: '',
            UMENG_CHANNEL: '',
        ]
    }
}

MainApplicationonCreate 方法进行初始化,如下:

override fun onCreate() {
    val metaData = packageManager.getApplicationInfo(packageName, PackageManager.GET_META_DATA).metaData

    // 初始化友盟基础库
    // 第三个参数表示是否显示调试信息
    RNTUmengAnalyticsModule.init(this, metaData, false)
    // 初始化友盟统计
    RNTUmengAnalyticsModule.analytics(this)
}

配置混淆规则

android/app/proguard-rules.pro 添加以下混淆规则,注意替换自己的包名,并且删掉 []

-keep public class [您的应用包名].R$*{
public static final int *;
}

Usage

import umengAnalytics from 'react-native-pure-umeng-analytics'

// 集成测试,获取设备信息
umengAnalytics.getDeviceInfo().then(data => {
  data.deviceId
  // android only
  data.mac
})

// 帐号统计
umengAnalytics.signIn('userId')
// provider: 不能以下划线开头,使用大写字母和数字标识; 如果是上市公司,建议使用股票代码,比如 WB
umengAnalytics.signIn('userId', 'provider')
umengAnalytics.signOut()

// 页面统计,注意要配对调用
// 不能连续调用 enterPage,也不能连续调用 leavePage
umengAnalytics.enterPage('pageName')
umengAnalytics.leavePage('pageName')

// 自定义事件,eventId 需先在友盟后台注册之后才可以统计
umengAnalytics.sendEvent('eventId')
umengAnalytics.sendEventLabel('eventId', 'label')
umengAnalytics.sendEventData('eventId', { key1: 'value1', key2: 'value2' })
umengAnalytics.sendEventCounter('eventId', { key1: 'value1', key2: 'value2' }, 1)