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-growing-tracker

v1.0.1-cdp

Published

GrowingIO Tracker SDK 3.0

Downloads

4

Readme

react-native-growing-tracker

GrowingIO Tracker SDK 3.0, CDP版本

环境配置

请确保已经添加CDP埋点SDK, 如果没有, 请移步至CDP原生端SDK集成文档

添加依赖

$ npm install [email protected] --save

使用本地模块(进行自定义修改)

  1. git clone 插件仓库
git clone [email protected]:growingio/react-native-growingio-sdk-tracker-plugin.git
git checkout cdp
  1. 在项目的package.json中添加对应模块
"dependencies": {
    ...
    "react-native-growing-tracker": "file:path/react-native-growingio-sdk-tracker-plugin"
  },
  1. 获取依赖
yarn
  1. 执行项目
react-native run-ios
react-native run-android

自动安装 (React Native 0.6.0版本及其以上可以跳过该步骤)

$ react-native link react-native-growing-tracker

手动安装

iOS

  1. 打开Xcode,在您的工程目录中点击 LibrariesAdd Files to [your project's name]
  2. 选择添加 node_modules ➜ react-native-growingio-tracker ➜ RNGrowingTracker.xcodeproj
  3. 选择您的目标项目, Build PhasesLink Binary With Libraries添加 libRNGrowingTracker.a
  4. 运行项目 (Cmd+R)<

Android

  1. 打开您的首页Activity android/app/src/main/java/[...]/MainActivity.java
  • 导入包文件 com.reactnativegrowingtracker.GrowingTrackerPackage;
  • getPackages() 方法中添加 new GrowingTrackerPackage()
  1. 引入Android Native工程 android/settings.gradle:
    include ':reactnativegrowingtracker'
    project(':reactnativegrowingtracker').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-growing-tracker//android')
  2. 在app中添加Android Native依赖 android/app/build.gradle:
    implementation project(':reactnativegrowingtracker')

引入到文件

import GrowingTracker from 'react-native-growing-tracker';

// TODO: What to do with the module?
GrowingTracker;

API说明

1 设置登录用户标识

1.1 GrowingTracker.setLoginUserId(userId)

设置登录用户标识。

1.2 参数说明

| 参数名 | 类型 | 必填 | 默认值 | 说明 | | :----: | :-----: | :--: | :----: | :-----------------------------------: | | userId | string | 是 | undefine | 设置登录用户标识 |

1.3 代码示例

GrowingTracker.setLoginUserId('loginUserId');

2 清除登录用户标识

2.1 GrowingTracker.cleanLoginUserId()

清除登录用户标识。

2.2 代码示例

GrowingTracker.cleanLoginUserId();

3 设置坐标

3.1 GrowingTracker.setLocation(latitude, longitude)

设置坐标。

3.2 参数说明

| 参数名 | 类型 | 必填 | 默认值 | 说明 | | :----: | :-----: | :--: | :----: | :-----------------------------------: | | latitude | number | 是 | undefine | 设置纬度 | | longitude | number | 是 | undefine | 设置经度 |

3.3 代码示例

GrowingTracker.setLocation(100.0, 100.0);

4 清除坐标

4.1 GrowingTracker.cleanLocation()

清除坐标。

4.2 代码示例

GrowingTracker.cleanLocation();

5 获取设备标识

5.1 GrowingTracker.getDeviceId()

设置坐标。

5.2 代码示例

GrowingTracker.getDeviceId().then(setDeviceId);

6 设置坐标

6.1 GrowingTracker.setDataCollectionEnabled(enabled)

是否采集数据。

6.2 参数说明

| 参数名 | 类型 | 必填 | 默认值 | 说明 | | :----: | :-----: | :--: | :----: | :-----------------------------------: | | enabled | boolean | 是 | undefine | 是否采集数据 |

6.3 代码示例

GrowingTracker.setDataCollectionEnabled(true);

7 设置登录用户属性

7.1 GrowingTracker.setLoginUserAttributes(attributes)

设置登录用户属性。

7.2 参数说明

| 参数名 | 类型 | 必填 | 默认值 | 说明 | | :----: | :-----: | :--: | :----: | :-----------------------------------: | | attributes | object | 是 | undefine | 登录用户属性 |

7.3 代码示例

GrowingTracker.setLoginUserAttributes({
    key1: 'value1',
    key2: 'value2',
});

8 自定义事件

8.1 GrowingTracker.trackCustomEvent(eventName, attributes, itemKey, itemId)

自定义事件。

8.2 参数说明

| 参数名 | 类型 | 必填 | 默认值 | 说明 | | :----: | :-----: | :--: | :----: | :-----------------------------------: | | eventName | string | 是 | undefine | 事件名称 | | attributes | object | 否 | null | 事件属性 | | itemKey | string | 否 | null | 物品模型唯一标识属性 | | itemId | string | 否 | null | 物品模型唯一标识属性的值 |

8.3 代码示例

GrowingTracker.trackCustomEvent('trackCustomEvent(string)', null);

GrowingTracker.trackCustomEvent('trackCustomEvent(string)', {
    key1: 'value1',
    key2: 'value2',
});

Contributing

See the contributing guide to learn how to contribute to the repository and the development workflow.

License

MIT