1.0.8 • Published 1 year ago

dfh-burial-point v1.0.8

Weekly downloads
-
License
MIT
Repository
-
Last release
1 year ago

数据埋点

基于uni-app,支持点击、浏览、曝光

安装

npm install dfh-burial-point

引入

import dfh from 'dfh-burial-point';

注册埋点

注册埋点,埋点注册成功后,会在vue中注册一个$buriedPoint全局属性(如果不想用全局,初始化方法会返回埋点实例,自行处理),此函数中有所有埋点暴露的方法,例如:click

// main.js
export function createApp() {
  const app = createSSRApp(App);
  // 添加埋点
  const dfh_buried = dfh.setOptions({
    app,
    footprint: true,
    server_url:`http://*****/api/***`, // 数据上报地址
    defaultData: {     // 默认值
      s_app_version: '1.0.0',
    },
    request: axios || uni.request,  // 
    closed: process.env.NODE_ENV === 'development'
  });
  return {
    app,
  };
}

options说明

参数说明类型可选值默认值
server_url服务上报地址string必填-
closed开发环境是否发送埋点Booleanfalse:开启/true:关闭false
footprint开启页面浏览埋点Booleanfalse/truefalse
autoSendFootPrint页面浏览埋点是否自动发送,需开启页面浏览埋点Booleanfalse/truetrue
request网络请求方法Functionuni-ap传入:uni.request-
defaultData默认埋点的数据---
session_id会话ID---

路由meta配置

参数说明类型可选值默认值必传
footprint_model开启页面浏览埋点后,单个页面埋点是否自动上报Booleanfalse/truefalse
current_buried_point开启页面自动发送埋点后,关闭单个页面埋点上报Booleanfalse/truefalse
page_id页面ID---
page_name页面名称---

指令方式使用

v-buried-point="{ attr: '点击埋点发送'}"
v-buried-exposure = "{attr: '自动曝光发送'}"

:::

函数方式使用

点击

const { proxy }  = getCurrentInstance();
  proxy.$buriedPoint.click({ 
    event_name: 'channel',
    sss: '1121212',
    vbnvbnvbn: '塑料袋福建省地方'
  });

曝光

const { proxy }  = getCurrentInstance();
  proxy.$buriedPoint.exposure({ 
    event_name: 'channel',
    sss: '1121212',
    vbnvbnvbn: '塑料袋福建省地方'
  });

浏览

const { proxy }  = getCurrentInstance();
  proxy.$buriedPoint.browse({ 
    event_name: 'channel',
    sss: '1121212',
    vbnvbnvbn: '塑料袋福建省地方'
  });

路径后缀获取

路径后缀获取的信息,直接放在路由参数对象中,前提开始自动上报浏览埋点。(page_id、page_name、source_location_id),其中page_id、page_name配置在路由meta中即可,如果是webview,无法监控到路由变化,需要手动上传

1.0.8

1 year ago

1.0.7

1 year ago

1.0.6

1 year ago

1.0.5

1 year ago

1.0.4

1 year ago

1.0.3

1 year ago

1.0.2

1 year ago

1.0.1

1 year ago