New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details →
Socket
Book a DemoSign in
Socket

nplus-ba

Package Overview
Dependencies
Maintainers
1
Versions
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

nplus-ba

vue百度统计插件

latest
npmnpm
Version
1.0.0
Version published
Maintainers
1
Created
Source

nplus-ba

vue百度统计插件

安装

$ npm install --save nplus-ba

引入

import Vue from 'vue'
import router from './router' // vue-router 实例
import hmt from 'vue-hmt'

const options = {
  siteId: 'siteId',
  debug: true,
  autoPageview: false
}

Vue.use(hmt, { options, router })

参数说明

参数是否必填说明
hmtvue-hmt 实例
options详见options 参数说明
routervue-router 实例,不填则路由变换不会自动trackPageview

 

options

参数是否必填类型说明备注
siteIdString统计网站唯一ID
debugBoolean默认 false,开启后会在控制台打印统计传递的参数请勿在生产环境中使用
autoPageview否 Boolean默认 true,开启后会自动统计当前页面的PV可配合trackPageview自定义要统计页面的URL

使用

事件统计(trackEvent)

this.$hmt.trackEvent('category', 'action', 'opt_label', 'opt_value')

参数说明

参数是否必填类型说明备注
categoryString要监控的目标的类型名称不填或填"-"的事件会被抛弃
actionString用户跟网页进行交互的动作名称不填或填"-"的事件会被抛弃
opt_labelString事件的一些额外信息不填或填"-"代表此项为空
opt_valueNumber跟事件相关的数值 -

页面浏览统计(trackPageview)

this.$hmt.trackPageview(pageURL)

参数说明

参数是否必填类型说明备注
pageURLString指定要统计PV的页面URL必须是以"/"(斜杠)开头的相对路径

Keywords

nplus

FAQs

Package last updated on 02 Jul 2019

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