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 🙏

© 2025 – Pkg Stats / Ryan Hefner

react-native-eagleeye

v1.0.8

Published

Get device information & auto track event

Readme

react-native-eagleeye

RN版本的统计和反作弊的SDK

Android初始化

  1. react native 引用插件
npm install react-native-eagleeye
# or
yarn add react-native-eagleeye
  1. 运行命令
!!!Warning Tip!!!

插件:react-navigation,后续插件版本升级会做相对更新!!!

node node_modules/react-native-eagleeye/HawkeyeDataRNHookNew.js -run
  1. 新增maven仓库
your-react-native-project/
├── android/
│   ├── app/
│   ├── build.gradle           <<<--------# 新增maven仓库
│   ├── settings.gradle
├── node_modules/
├── package.json

allprojects {
    repositories {
        ......
        maven { url "https://raw.githubusercontent.com/SimiTalk/sdk_eagleeye/main" } //新增
        //     maven { url "https://gitee.com/simitalk/sdk_eagleeye/raw/main" } //gitee 镜像
    }
}
  1. MainApplication的onCreate方法中增加EagleEyeDataAPI.init(this);
your-react-native-project/
├── android/
│   ├── app/
        └──MainApplication.java         # 你的Application类
│   ├── libs/
│   ├── build.gradle                    
│   ├── settings.gradle
├── node_modules/
├── package.json

import com.coolook.eagleye.EagleEyeDataAPI;

  @Override
  public void onCreate() {
    EagleEyeDataAPI.init(this);
  }

React Native 初始化

初始化获取设备信息 参数 -> yourApplyKey 返回参数 -> { "msg": 返回信息-string, "suc": 是否成功-bool }

import EagleEyeAgent from 'react-native-eagleeye';
// rn调用初始化
 EagleEyeAgent.init(Platform.OS === 'ios' ? 'yourApplyKey' : 'yourApplyKey').then(value => {
      console.log('EagleEyeAgent init = ', value);
    });

API

  1. trackEvent : 自定义行为上报 参数 -> (事件名称-string,事件参数-string)
EagleEyeAgent.trackEvent('yourEventName','事件参数(json字符串)');    // 自定义上报
  1. userProperty : 自定义用户属性 参数 -> (属性名-string,属性值-string)
EagleEyeAgent.userProperty('key','value');    // 自定义用户属性
  1. cleanUserProperty : 根据key删除某个用户属性 参数 -> (属性名-string)
EagleEyeAgent.cleanUserProperty('key');    // 根据key删除某个用户属性
  1. cleanAllUserProperties : 清除所有用户属性
EagleEyeAgent.cleanAllUserProperties();    // 清除所有用户属性
  1. getId : 获取设备唯一ID EagleEyeAgent.init初始化成功后调用 返回参数 -> (设备ID-string)
EagleEyeAgent.getId().then( id => {
    // 初始化成功后可获取 返回值-> 获取设备唯一ID
});

iOS

如需要获取IDFA权限,可在同意用户协议后获取权限,并在项目Info.plist中添加IDFA权限描述 示例

import { check, request, PERMISSIONS, RESULTS } from 'react-native-permissions';

 initIDFAPermissions = async () => {
    //ios获取IDFA权限
    setTimeout(async () => {
      try {
        if (Platform.OS === 'ios') {
          const permission = PERMISSIONS.IOS.APP_TRACKING_TRANSPARENCY;
          const result = await check(permission);

          if (result === RESULTS.DENIED) {
            const requestResult = await request(permission);
            if (requestResult === RESULTS.GRANTED) {
              console.log('IDFA权限通过');
            } else {
              console.log('IDFA权限被拒绝');
            }
          } else if (result === RESULTS.GRANTED) {
            console.log('IDFA权限通过');
          } else {
            console.log('IDFA权限状态:', result);
          }
        }
      } catch (error) {
        console.error('获取IDFA权限时出错:', error);
      }
    }, 1000);
  };