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 🙏

© 2026 – Pkg Stats / Ryan Hefner

cess-actions-sdk

v1.0.2

Published

## 介绍

Readme

cess-actions-sdk

介绍

行为数据上报

安装方式

npm i cess-actions-sdk

使用方式

npm包引入

import { CessActionsSDK } from 'cess-actions-sdk' 
// 初始化SDK
const sdk = new CessActionsSDK({
    businessId: '19',
    domain: 'http://172.21.80.140:32080',
    token: 'd768e9ac9a5543ee8a56601ca5a028cc'
})
sdk.sendActionData([
    {
        "itemId": "12345678990",
        "itemSetId": 80,
        "actionTime": 1554803592000,
        "action": "detailPageShow",
        "userId": "ceshiyonghu1",
        "traceId": "ca6feae726b5b946-1236786678",
        "ip": "192.168.1.2",
        "position": "home_feed",
        "originPosition": "menu_productList",
        "os": "android",
        "deviceId": "41B2FD07-695A-4A27-8D26-C30ECE6F7EAD",
        "sceneId": "176",
        a: 23
    }
]).then(()=>{
    console.log('success')
})
.catch((err)=>{
    console.log(err)
})

script引入

<script  src="../dist/umd/index.js"></script> <!-- 确保路径正确 -->  
<script>
    const { CessActionsSDK } = window['cess-actions-sdk'];
    const sdk = new CessActionsSDK({
        businessId: '19',
        domain: 'http://172.21.80.140:32080',
        token: 'd768e9ac9a5543ee8a56601ca5a028cc'
    })
    document.getElementById('fetchDataBtn').addEventListener('click', function() {  
        console.log(sdk.getBusinessId())
        sdk.sendActionData([
            {
                "itemId": "12345678990",
                "itemSetId": 80,
                "actionTime": 1554803592000,
                "action": "detailPageShow",
                "userId": "ceshiyonghu1",
                "traceId": "ca6feae726b5b946-1236786678",
                "ip": "192.168.1.2",
                "position": "home_feed",
                "originPosition": "menu_productList",
                "os": "android",
                "deviceId": "41B2FD07-695A-4A27-8D26-C30ECE6F7EAD",
                "sceneId": "176",
            }
        ]).then(()=>{
            console.log('success')
        })
        .catch((err)=>{
            console.log(err)
        })
    });  
</script>  

SDK初始化参数说明

| 英文字段名称 | 字段类型 | 是否必传 | 描述 | 举例 | | :--: | :--: | :--: | :--: | :--: | | businessId | string | ✔ | businessId可在天枢后台查看 | 19 | | domain | string | ✔ | 如果您是天枢SaaS版的用户,请将domain对应替换成https://growth.4paradigm;如果您是天枢私有化版的用户,请将domain对应替换成私有化部署的域名 | http://172.21.80.140:32080 | | token | string | ✔ | 请前往产品页面:行为数据_API接口上传,查看token | dfe2cd0614244e58950475bb2f5e18b3 |

接口参数说明

| 英文字段名称 | 字段类型 | 是否必传 | 描述 | 举例 | | :--: | :--: | :--: | :--: | :--: | | sceneld | string | ✔ | 场景ID(天枢后台查看) | 189 | | actionTime | number | ✔ | 用户行为发生的时间(毫秒时间戳) | 1616581256 | | processTime | number | ✖ | 用户行为上报的接收时间(毫秒时间戳) | 1616581256 | | action | string | ✔ | 行为类型 | addToCart | | userld | string | ✔ | 用户ID | 100002 | | traceId | string | ✔ | 物料的溯源Id,推荐接口返回的traceId,非常重要,用于串联推荐及推荐物料的点击、观看、购买等,同一物料上报点击、加购等行为的traceId应一样。一般处理:请求推荐接口时带上requestId(每次请求唯一),推荐接口在每个推荐物料都会返回traceId,规则为requestId+itemId,后续这条推荐物料的行为上报都是这个traceId | ca6feae726b5b946-1236786678 | | itemSetld | number | ✔ | 物料库ID(天枢后台查看) | 32 | | itemld | string | ✔ | 行为针对的物料ID | 219 | | explds | string | ✖| 实验id | 1212,332 | | ip | string | ✖ | IP地址 | 192.168.1.2 | | channel | string | ✖ | 线上渠道类型 | 如H5、App、MP(微信小程序) | | position | string | ✖ | 当前交互触点 | productDetailPage_addToCart | | originPosition | string | ✖ | 曝光来源触点 | homePage_recommendation | | model | string | ✖ | 移动终端型号 | iPhone12 | | os | string | ✖ | 移动终端的操作系统 | ios | | deviceld | string | ✖ | 设备ld | 01a0sdaa123asss | | shareChannel | string | ✖ | 分享渠道 | 朋友圈 | | duration | number | ✖ | 浏览时长(秒) | 254 | | amount | number | ✖ | 成交金额 | 135136.99 | | quantity | number | ✖ | 成交数量 | 135136 | | isdiscount | number | ✖ | 是否有折扣 | 1 | | discountAmount | number | ✖ | 折扣金额 | 0.98 | | discountType | string | ✖ | 折扣类型 | 会员卡 | | orderld | string | ✖ | 订单ID | e123123 | | device_brand | string | ✖ | 设备品牌 | - | | stayTime | number | ✖ | 停留时长(ms) | - | | publisherld | string | ✖ | 作者id | - | | queryValue | string | ✖ | 搜索关键词 | - | | province | string | ✖ | 发生行为的省份 | - | | city | string | ✖ | 发生行为的城市 | - | | region | string | ✖ | 发生行为的区县 | - |

API

属性 | 说明 | 返回值 | ----|-----|------| | getBusinessId | 获取BusinessId | - | | getToken | 获取Token | - | | getDomain | 获取Sceneld | - | | sendActionData | 发送用户行为数据 | |

发送用户行为数据说明

正常

{
    "code": 200,
    "info": "success",
    "data": {
        "totalData": 1,
        "successData": 1,
        "filterData": 0
    }
}

异常

token错误
{
    "code":-103,
    "info":"param incorrect",
    "data":{
        "totalData":0,
        "successData":0,
        "filterData":0
    }
}