Giter Site home page Giter Site logo

bertyyh / ans-wechat-sdk Goto Github PK

View Code? Open in Web Editor NEW

This project forked from analysys/ans-wechat-sdk

0.0 0.0 0.0 1002 KB

Analysys WeChat SDK

Home Page: https://docs.analysys.cn/ark/integration/sdk/wx

License: GNU General Public License v3.0

JavaScript 100.00%

ans-wechat-sdk's Introduction

易观方舟 ans-wechat-sdk NPM version License GitHub release

安装

$ npm install ans-wechat-sdk --save

wechat SDK 基础说明

  • 快速集成

    // 非es6 
    var AnalysysAgent = require("ans-wechat-sdk");
    // 小程序提供了加密模块 根据自己需要引入
    var AnalysysEncryption = require('ans-wechat-sdk/sdk/AnalysysAgent_encryption.min.js');
    // sdk 与 加密模块关联
    AnalysysAgent.encrypt = AnalysysEncryption;
    
    // es6 
    import AnalysysAgent from "ans-wechat-sdk"
    import AnalysysEncryption  from 'ans-wechat-sdk/sdk/AnalysysAgent_encryption.min.js';
    AnalysysAgent.encrypt = AnalysysEncryption;
    
    
    // wechat SDK 初始化
    AnalysysAgent.appkey = "/*设置为实际APPKEY*/" 
    AnalysysAgent.uploadURL = "/*设置为实际地址*/"
    AnalysysAgent.debugMode = 1
    AnalysysAgent.autoProfile = false
    AnalysysAgent.encryptType = 1
    AnalysysAgent.allowTimeCheck = true
    AnalysysAgent.maxDiffTimeInterval = 20 
    AnalysysAgent.autoTrack = true
    
  • appkey(必须) 在网站获取的 AppKey

  • debugMode 设置调试模式:0 - 关闭调试模式(默认);1 - 开启调试模式,数据不入库;2 - 开启调试模式,数据入库

  • uploadURL(必须) 自定义上传地址

  • autoProfile 设置是否追踪新用户的首次属性:false - 不追踪新用户的首次属性;true - 追踪新用户的首次属性(默认)

  • encryptType 设置是否对上传数据加密:0 - 对上传数据不加密(默认);1 - 对上传数据进行AES 128位ECB加密;2 对上传数据进行AES 128位CBC加密

  • allowTimeCheck 设置是否开启时间校准:false(默认) - 关闭时间校准;true - 开启时间校准

  • maxDiffTimeInterval 设置最大时间校准分为:30s(默认) ,当设置的时间差值小于他,将不开启校准。否则将会进行时间校准。假如设置成为负值,将默认为 30s。

  • autoTrack 设置是否开启全埋点,false - 不开启全埋点(默认);true - 开启全埋点;开启全埋点将会上报所有绑定(支持tab、longtab、longpress)事件,并上报$user_click 事件,设置data-content为采集的 $element_content、data-type为采集的 $element_type、data-name为采集的$element_name、id为采集的$element_id。不设置采集不到。不支持系统方法包括生命周期事件的上报,如果要采集tabbar切换,务必在注册Page的时候注册OnTabItemTap方法,否则采集不到。

微信小程序要手动上报启动事件。

App({
    onShow : function( options ){
        //设置微信小程序启动事件,并传输UTM等参数
        AnalysysAgent.appStart(options)
    }
});

// 注,各个页面调用API 要加上这个定义,直接引用
let AnalysysAgent = wx.AnalysysAgent

通过以上步骤您即可验证SDK是否已经集成成功,更多Api使用方法参考:易观方舟 wechat SDK 文档

注意 SDK 可能不完全向前兼容,请查看版本更新说明 Release及版本升级记录。如果有说明不兼容的话,需要升级易观方舟对应的版本。 请根据需要前往 Release 里下载对应的文件

npm 安装适用于框架版小程序,基础版和插件版原生开发的小程序使用详见:易观方舟 wechat SDK 文档

版本升级记录

请参见 Release及版本升级记录

讨论

禁止一切基于易观方舟 wechat 开源 SDK 的所有商业活动!


NPM downloads

ans-wechat-sdk's People

Contributors

analysyszhangyufei avatar omgmountain avatar nielifeng avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.