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

operation-sdk-module

v1.1.2

Published

Operation SDK plugin for react-native

Readme

Operation SDK Module

React Native 运营SDK插件,基于个推GSIDO SDK构建,提供用户行为分析、事件追踪、用户画像等运营功能。

📋 版本信息

本SDK基于个推官方SDK构建,使用以下版本:

  • 用户运营SDK (GSIDO): 1.4.12.0
  • 个推核心组件 (GTC): 3.2.18.0

安装

npm install operation-sdk-module

配置

Android 配置

android/app/build.gradle 中添加:

dependencies {
    implementation project(':@step.ai_operation-sdk-module')
}

iOS 配置

ios/Podfile 中添加:

pod 'operation-sdk-module', :path => '../node_modules/operation-sdk-module'

然后运行:

cd ios && pod install

个推应用配置

  1. 在个推控制台创建应用并获取 AppID、AppKey、AppSecret
  2. 在应用初始化时配置这些参数
  3. 详细配置说明请参考 example/document/configuration-guide.md

快速开始

1. 初始化SDK

import Operation from 'operation-sdk-module';

// 设置安装渠道(可选,在初始化前调用)
Operation.setInstallChannel('huawei_app_market');

// 设置会话超时时间(可选,默认30秒)
Operation.setSessionTimeoutMillis(30000);

// 初始化运营SDK
Operation.initSDK();

2. 设置用户信息

// 设置用户信息
Operation.setUserInfo({
  userId: 'user123',
  userName: '张三',
  userEmail: '[email protected]',
  userAge: 25,
  userGender: 'male'
});

3. 追踪事件

// 追踪用户行为事件
Operation.trackEvent('user_login', {
  loginMethod: 'password',
  source: 'app'
});

Operation.trackEvent('purchase', {
  productId: 'prod_001',
  price: 99.99,
  currency: 'CNY'
});

// 设置用户属性
Operation.setUserProperties({
  sex: '男',
  age: 25,
  registerTime: '2024-01-01',
  registerChannel: 'app_store'
});

// 获取GTCID
Operation.getGtcId((gtcId) => {
  console.log('GTCID:', gtcId);
});

// 获取设备信息 Operation.getDeviceId((deviceId) => { console.log('设备ID:', deviceId); });

// 获取SDK状态 Operation.getStatus((status) => { console.log('SDK状态:', status); });


### 4. 监听事件

```javascript
import { NativeEventEmitter } from 'react-native';

// 监听SDK事件
const eventEmitter = new NativeEventEmitter();
const subscription = eventEmitter.addListener('OperationSDKDidTrackEvent', (data) => {
  console.log('事件追踪成功:', data);
});

// 监听GTCID获取事件
const gtcIdSubscription = eventEmitter.addListener('OperationSDKDidGetGtcId', (data) => {
  console.log('GTCID获取成功:', data.gtcId);
});

// 记得在组件卸载时移除监听
componentWillUnmount() {
  subscription.remove();
  gtcIdSubscription.remove();
}

API 接口

基础功能

  • initSDK() - 初始化运营SDK
  • setInstallChannel(channel) - 设置安装渠道
  • setSessionTimeoutMillis(time) - 设置会话超时时间
  • setUserInfo(userInfo) - 设置用户信息
  • getUserInfo(callback) - 获取用户信息
  • setUserProperties(properties) - 设置用户属性
  • trackEvent(eventName, properties) - 追踪事件
  • getGtcId(callback) - 获取GTCID

配置功能

  • setChannelId(channelId) - 设置渠道信息
  • setLocation(latitude, longitude) - 设置地理位置
  • setAppVersion(version) - 设置应用版本
  • setLanguage(language) - 设置语言
  • setTimezone(timezone) - 设置时区

设备信息功能

  • getDeviceId(callback) - 获取设备ID
  • getGtcId(callback) - 获取GTCID
  • getVersion(callback) - 获取SDK版本
  • getStatus(callback) - 获取SDK状态

调试功能

  • setDebugMode(enable) - 开启调试模式

生命周期

  • resume() - 恢复SDK运行
  • destroy() - 销毁SDK

事件类型

  • OperationSDKDidInitialize - SDK初始化完成
  • OperationSDKDidSetUserInfo - 用户信息设置完成
  • OperationSDKDidTrackEvent - 事件追踪完成
  • OperationSDKDidGetGtcId - GTCID获取完成
  • OperationSDKDidOccurError - 发生错误

示例项目

查看 example/ 目录下的示例项目:

  • example/ExpoTestApp/ - Expo测试应用
  • example/TestApp/ - React Native测试应用
  • example/document/ - 详细文档

相关文档

许可证

ISC