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

dingcloud-sdk

v1.1.13

Published

Ding-cloud数据埋点sdk

Downloads

4

Readme

数据采集JS-SDK

重要申明

该包到1.1.13后不在升级维护,包以迁移至@dingdaoos/dingcloud-sdk

新手入门

什么是数据采集JS-SDK

  • JS数据采集SDK是为开发者提供的,用来统一并采集服务数据的前端集成工具,实现服务数据联运

数据采集JS-SDK能做什么

  • SDK可以完成常用的页面用户行为及元素的数据采集;完成数据加密上报至鼎道大数据平台
  • 可以支持服务快速接入

数据应用

  • 服务分析、用户分群、用户细查、转化分析、 服务推荐

产品使用指南

基础功能

只需引入SDK即可,无需添加任何参数。引入方式参见下章前端快速接入中“引入”相关描述

拓展功能

如有产品个性化需求请使用拓展功能。引入方式参见下章前端快速接入中“拓展功能”相关描述

前端快速接入

上传数据格式要求

JS-SDK要求传入的数据为json字符串,请注意是json格式的字符串不是json,前端json转换为对应字符串的方法:JSON.stringify(json) 若传入格式有误,数据将无法正确采集,并会发出以下警告: avatar 参见下方数据格式要求:

let data= {
    "Event":"show",
    "Object":"text",
    "ObjectName":"曝光",
    "Content":"北京",
    "Platform":"handle/evodock/lychee/service view"
}

数据字段定义: | key | 字段描述 | 是否必传 | 类型 | 校验 | 错误警告 | | :----: | :----: | :----: | :----: | :---- | :----: | | Event | 触发上报的动作事件 | 是 | String | 选值,非自定义,可选值:show (当前页面曝光)click(单击了一个对象)dbclick(双击事件/内容元素)hover(鼠标划过事件/内容元素)leave(鼠标离开事件/内容元素)onerror(服务/页面加载失败/错误)scroll(页面滚动)onload(服务/页面加载成功)copy(内容元素复制)cut(内容元素剪贴)onselect(选中页面内容)keyboard(键盘输入)drag(拖拽) | avatar | | Object | 对象(触点) | 是 | String | 对象的属性属性示例:button(按钮)link(链接)page(页面)operation(运营位)可自定义 | - | | ObjectName | 对象名称 | 否 | String | | - | | Content | 自定义内容 | 否 | String | | - |

  • 正确示例参见下方集成方法

集成方法

JS-SDK为您提供四种前端集成方式,无论您的项目采用何种开发模式,都可以找到您对应的集成方法。

  1. ES6模块化导入 npm安装
npm install dingcloud-sdk
  • vue项目
//在main.js文件引用
import DC_SDK from 'dingcloud-sdk'
//建议挂载在Vue的prototype上,方便全局使用,但这不是必须的,您可以根据需要按需引入到单个页面(在单页面import DC_SDK from 'dingcloud-sdk')
Vue.prototype.DC_SDK = DC_SDK;
//调用方法
this.DC_SDK.track.post(string);
//--------main.js结束----------
//在需要调用sdk的页面:拓展功能示例
let data= {
    "Event":"show",
    "Object":"text",
    "ObjectName":"曝光",
    "Content":"北京",
    "Platform":"handle/evodock/lychee/service view"
}
this.DC_SDK.track.post(JSON.stringify(data)) 
  • react项目
import DC_SDK from 'dingcloud-sdk'
import React from  'react'
React.Component.prototype.DC_SDK = DC_SDK;
//调用
React.DC_SDK.track.post(string);
//--------入口文件引入结束----------
//在需要调用sdk的页面:拓展功能示例
let data= {
    "Event":"show",
    "Object":"text",
    "ObjectName":"曝光",
    "Content":"北京",
    "Platform":"handle/evodock/lychee/service view"
}
React.DC_SDK.track.post(JSON.stringify(data)) 
  • 其他框架项目引入方式同理
  1. script形式同步导入
<html>
    <head>
        <!-- 引入 -->
        <script src="https://js.dingcloud.com/web-sdk/1.0.5/dingcloud-sdk.min.js" />
    </head>
</html>

<script>
//拓展功能示例
let data= {
    "Event":"show",
    "Object":"text",
    "ObjectName":"曝光",
    "Content":"北京",
    "Platform":"handle/evodock/lychee/service view"
}
window.DC_SDK.track.post(JSON.stringify(data)) 
</script>
  1. CommonJs规范加载
  • npm安装
npm install dingcloud-sdk
  • 引入方式
const DC_SDK = require("dingcloud-sdk")
//调用
DC_SDK.track.post(string);
//拓展功能示例
let data= {
    "Event":"show",
    "Object":"text",
    "ObjectName":"曝光",
    "Content":"北京",
    "Platform":"handle/evodock/lychee/service view"
}
DC_SDK.track.post(JSON.stringify(data)) 
  1. AMD规范加载
  • 引入方式
requirejs(["https://js.dingcloud.com/web-sdk/1.0.5/dingcloud-sdk.min.js"], function(DC_SDK) { 
    //调用
    DC_SDK.track.post(string);
    
    //拓展功能示例
    let data= {
        "Event":"show",
        "Object":"text",
        "ObjectName":"曝光",
        "Content":"北京",
        "Platform":"handle/evodock/lychee/service view"
    }
    DC_SDK.track.post(JSON.stringify(data)) 
});

JS-SDK历史版本

1.1.13

基础稳定版