Socket
Book a DemoInstallSign in
Socket

@58fe/log-plugins

Package Overview
Dependencies
Maintainers
11
Versions
26
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@58fe/log-plugins

A plugin for tracklog.

npmnpm
Version
1.1.0
Version published
Weekly downloads
31
Maintainers
11
Weekly downloads
 
Created
Source

log-plugins 埋点插件

npm version

安装

npm i @58fe/log-plugins -S

使用

es6

import { Log } from "@58fe/log-plugins";
Log(args);

vue

// 引入
import { VueLog } from "@58fe/log-plugins";
Vue.use(VueLog);
// or
// 埋点默认项,参数传‘’会取配置项字段
Vue.use(VueLog, {
    debug: false,  // true: 打印埋点
    pageType: 'home',
    actionType: 'show',
    cate: '9224',
    p1: '1', // p1-p8字段见下列【58app埋点说明】
    ...
    p8: '8'
});
点击埋点:v-log-click="args"

展示埋点:v-log-show="args"

原型使用:this.$log(args);

示例

v-log-click="['home','click']"
this.$log(['home','click']);

react

// 引入
import React from "react";
import { ReactLog } from "@58fe/log-plugins";
ReactLog(React);
// or
// 埋点默认项,参数传‘’会取配置项字段
ReactLog(React, {
    debug: false,  // true: 打印埋点
    pageType: 'home',
    actionType: 'show',
    cate: '9224',
    p1: '1', // p1-p8字段见下列【58app埋点说明】
    ...
    p8: '8'
});

// 组件使用
React.$log(args);

示例

React.$log(['home','click']);

RN

// 引入
import React from "react";
import WBAPP from '@w/wbapp';
import { RNLog } from "@58fe/log-plugins";
RNLog(React, {
    ctx: WBAPP, // RN需要显示传入执行环境,其他用法同react
    debug: false, 
    pageType: 'home',
    actionType: 'show',
    cate: '9224',
    p1: '1',
    ...
    p8: '8'
});

// 组件使用
React.$log(args);

参数 args

args 类型为数组

参数必填类型说明
pageTypetruestring/number页面类型,args 第一个值
actionTypepc:false/app:truestring/number埋点类型,args 第二个值
optsfalseobject其他配置,对应 app opts,args 第三个值

58app 埋点说明

opts = {
    cate: "",
    params: [],
};

params 数组值对应埋点表中 p1、p2、p3 等字段,即[p1,p2,p3,p4,p5,p6,p7,p8]

Keywords

log

FAQs

Package last updated on 22 Dec 2020

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts