minlingchao1 / vue-ba Goto Github PK
View Code? Open in Web Editor NEWvue 百度统计埋点插件
vue 百度统计埋点插件
因为我们的项目分两个板块,我们想一个siteId记录一个板块。这样的话,如果我想在一个项目里面使用两个百度统计的siteId,怎么做?
如果在main.js 中配置了引用,是否就已经可以统计uv和pv 了呢,因为这个库看起来是做埋点用的。
import ba from 'vue-ba'
import './assets/css/normalize.css'
Vue.config.productionTip = false;
Vue.use(ba, "175015a6227dca437e13abb9a6e845ac");
Vue.use(ba, { siteId: "175015a6227dca437e13abb9a6e845ac" });
通过传递
options 参数进行更多设置
Vue.use(uweb,options)
这里用了uweb应该是友盟那个库的用法吧
我注意到源代码options里有配置如下:
autoPageview
但是README.md里面options说明没有这段话:
README.md里的options
_hmt.push(['_setAutoPageview', false]);
_hmt.push(['_trackPageview', '/new/path/new/name']);
在例子中,我们首先使用了_setAutoPageview接口关闭了自动PV跟踪,然后使用了_trackPageview接口来发送新的PV统计请求。
这样在页面被访问时,记入PV的就不是原URL了,而是您指定的新的URL。
请注意上述代码最好能够加在页头标签前,至少要保证位于百度统计分析代码的前面。
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.