All Projects → minlingchao1 → Vue Ba

minlingchao1 / Vue Ba

vue 百度统计埋点插件

Programming Languages

javascript
184084 projects - #8 most used programming language

Projects that are alternatives of or similar to Vue Ba

Densenet Sdr
repo that holds code for improving on dropout using Stochastic Delta Rule
Stars: ✭ 148 (-4.52%)
Mutual labels:  statistics
Pg qualstats
A PostgreSQL extension for collecting statistics about predicates, helping find what indices are missing
Stars: ✭ 150 (-3.23%)
Mutual labels:  statistics
Stability Selection
scikit-learn compatible implementation of stability selection.
Stars: ✭ 155 (+0%)
Mutual labels:  statistics
Vue Fullpage
a single page scroll plugin for [email protected] https://river-lee.github.io/vue-fullpage/examples/
Stars: ✭ 148 (-4.52%)
Mutual labels:  vuejs2
Multiple Select
A jQuery plugin to select multiple elements with checkboxes :)
Stars: ✭ 1,847 (+1091.61%)
Mutual labels:  vuejs2
Tera
An Internet-Scale Database.
Stars: ✭ 1,846 (+1090.97%)
Mutual labels:  baidu
Hep
hep is the mono repository holding all of go-hep.org/x/hep packages and tools
Stars: ✭ 146 (-5.81%)
Mutual labels:  statistics
Eiten
Statistical and Algorithmic Investing Strategies for Everyone
Stars: ✭ 2,197 (+1317.42%)
Mutual labels:  statistics
Gpk admin
✨ GeekPark Content Management System
Stars: ✭ 150 (-3.23%)
Mutual labels:  vuejs2
Vue Admin Manager
整合 vue,element,echarts,video,bootstrap(AdminLTE),admin等,搭建的后台管理系统
Stars: ✭ 153 (-1.29%)
Mutual labels:  vuejs2
Vue Full Loading
Full overlay loading with spinner for Vue
Stars: ✭ 148 (-4.52%)
Mutual labels:  vuejs2
Spacexstats React
SpaceXStats, with React and using the SpaceX API
Stars: ✭ 148 (-4.52%)
Mutual labels:  statistics
Stanford Cs229
Python solutions to the problem sets of Stanford's graduate course on Machine Learning, taught by Prof. Andrew Ng
Stars: ✭ 151 (-2.58%)
Mutual labels:  statistics
Contributions Importer For Github
This tool helps users to import contributions to GitHub from private git repositories, or from public repositories that are not hosted in GitHub.
Stars: ✭ 147 (-5.16%)
Mutual labels:  statistics
Vue Uweb
vue 友盟统计埋点插件
Stars: ✭ 154 (-0.65%)
Mutual labels:  statistics
Beep
BEEP Account Security Scanner - Detect if your credentials have been compromised (Vue + Ionic)
Stars: ✭ 148 (-4.52%)
Mutual labels:  vuejs2
Machine Learning With Python
Practice and tutorial-style notebooks covering wide variety of machine learning techniques
Stars: ✭ 2,197 (+1317.42%)
Mutual labels:  statistics
Tidyversity
🎓 Tidy tools for academics
Stars: ✭ 155 (+0%)
Mutual labels:  statistics
V Tooltip
💬 Easy tooltips, popovers, dropdown for Vue
Stars: ✭ 2,109 (+1260.65%)
Mutual labels:  vuejs2
Tableone
R package to create "Table 1", description of baseline characteristics with or without propensity score weighting
Stars: ✭ 151 (-2.58%)
Mutual labels:  statistics

vue-ba

vuejs 百度统计埋点插件

项目参考:https://github.com/raychenfj/vue-uweb

项目地址

https://github.com/minlingchao1/vue-ba

1. 安装

npm install vue-ba --save

直接在页面中引用

<script src="./node_modules/vue-uweb/dist/index.js"><script>

或者通过es6模块加载

import ba from 'vue-ba'

使用vue-ba插件

Vue.use(ba, 'YOUR_SITEID_HERE')

通过传递 options 参数进行更多设置

Vue.use(uweb,options)

options

参数 必须 默认 说明 备注
siteId 绑定要接受API请求的统计代码
debug false 调试模式下将在控制台中输出调用window._hmt时传递的参数 请不要在生产环境中使用,避免造成安全隐患
src https://hm.baidu.com/hm.js?SITEID 指定统计脚本标签的 src 属性

2. ba API

2.1 trackEvent

用于发送页面上按钮等交互元素被触发时的事件统计请求。

用法

this.$ba.trackEvent(category,action,opt_label,opt_value)

参数

参数 必须 类型 说明
category string 表示事件发生在谁身上
action string 表示访客跟元素交互的行为动作
opt_label string 用于更详细的描述事件
opt_value int 用于填写打分型事件的分值,加载时间型事件的时长,如果填写为其他形式,系统将按0处理。若填写为浮点小数,系统会自动取整,去掉小数点。

2.2 trackPageview

用于发送某个URL的PV统计请求,适用于统计AJAX、异步加载页面,友情链接,下载链接的流量

用法

this.$ba.trackPageview(pageURL)

参数

参数 必须 类型 说明
pageURL string 自定义虚拟PV页面的URL地址,填写以斜杠‘/’开头的相对路径,系统会自动补全域名

3. ba 指令

vue-ba 提供 track-event,track-pageview 两个指令,开发者可以直接在 html 模版中使用来统计网站数据

3.1 track-event

使用指令 v-track-event 监听事件, 通过 modifiers 指定事件类型,将自动为绑定元素添加事件监听,当事件触发调用统计代码。 如不指定事件,默认监听 click 事件。

可通过逗号分隔的字符串或对象字面量传递参数,以字符串传递时请注意参数顺序,可参考trackEvent API。

统计自定义事件使用 v-track-event.someEvent:custom

用法

<button v-track-event.click="'category, action''"></button> // 统计click事件

<button v-track-event="'category, action'"></button> // 统计click事件简写

<input v-track-event.keypress="'category, action'"> // 统计keypress事件

<input v-track-event.someEvent:custom="'category, action'"> // 统计someEvent事件,someEvent是自定义事件

<button v-track-event="'category, action, opt_label, opt_value'"><button> // 以字符串传递参数

<button v-track-event="{category:'event', action:'click'}"></button> // 以对象字面量传递参数

3.2 track-pageview

使用指令 track-pageview 统计虚拟 PV ,一般可以配合 v-show 或 v-if 来统计局部动态视图的 PV。

可通过逗号分隔的字符串或对象字面量传递参数,以字符串传递时请注意参数顺序,可参考trackPageview API 用法

<div v-show="show" v-track-pageview="'/bar'">bar</div> //  跟踪 v-show 绑定元素的虚拟pv

<div v-if="show" v-track-pageview="'/foo'">foo</div> // 跟踪 v-if 绑定元素的虚拟pv

<div v-track-pageview="'/tar'"></div> // 以字符串指定受访页面和来源

<div v-track-pageview="{pageURL:'/zoo''}"></div> // 以对象字面量指定受访页面和来源
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].