-
-
Notifications
You must be signed in to change notification settings - Fork 0
如何关闭首次加载的自动上报 #14
Comments
目前都是通过 新版本已经有一个可以手动上报的核心包,可以试试: npm i @web-analytics/core 创建实例: // @/libs/analytics.ts
import { createCnzzAnalytics } from '@web-analytics/core'
// Create and export the instance of cnzz analytics platform
export const cnzzAnalytics = createCnzzAnalytics({
websiteId: 'your_website_id',
debug: true,
}) 在需要的时候导入实例进行上报: // @/foo.ts
import { baiduAnalytics } from '@/libs/analytics'
// For more methods, please see the documentation below
baiduAnalytics.trackPageview({
// Some options...
}) 关于核心包的 API 文档在这里 https://analytics.js.org/core/ |
这个核心包很不错,手动上报也行,如果是自动上报,通过接收一个数组,比如在laravel+inertia+vue的组合用法里面,路由是由laravel控制的,所以没有用到vue的路由插件,所以这也是我为什么要关闭自动上报的一个原因 |
原来如此!我后面在新包上面看看怎么加个选项来支持这种情况,谢谢! |
这个新的核心包首次加载的时候会自动上报吗?我现在的方案是,如果首次加载则自动上报而不手动去上报,其他页面则是手动上报 |
不会的,因为它是为了给其它上层框架的包做基础功能支持(例如后面的 Vue 插件、VitePress 插件、React插件等),所以它没有提供额外的自动功能,需要手动调用 API 上报 |
No description provided.
The text was updated successfully, but these errors were encountered: