Giter Site home page Giter Site logo

Comments (5)

xushulang avatar xushulang commented on June 29, 2024 1

这个核心包很不错,手动上报也行,如果是自动上报,通过接收一个数组,比如在laravel+inertia+vue的组合用法里面,路由是由laravel控制的,所以没有用到vue的路由插件,所以这也是我为什么要关闭自动上报的一个原因

from vue-cnzz-analytics.

chengpeiquan avatar chengpeiquan commented on June 29, 2024

目前都是通过 router.afterEach 自动上报的,这个包也很久没维护了,最近有在打算重构为新的版本,方便告知原因吗?我看看能不能作为一个选项加到新版本里。

新版本已经有一个可以手动上报的核心包,可以试试:

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/

from vue-cnzz-analytics.

chengpeiquan avatar chengpeiquan commented on June 29, 2024

这个核心包很不错,手动上报也行,如果是自动上报,通过接收一个数组,比如在laravel+inertia+vue的组合用法里面,路由是由laravel控制的,所以没有用到vue的路由插件,所以这也是我为什么要关闭自动上报的一个原因

原来如此!我后面在新包上面看看怎么加个选项来支持这种情况,谢谢!

from vue-cnzz-analytics.

xushulang avatar xushulang commented on June 29, 2024

这个核心包很不错,手动上报也行,如果是自动上报,通过接收一个数组,比如在laravel+inertia+vue的组合用法里面,路由是由laravel控制的,所以没有用到vue的路由插件,所以这也是我为什么要关闭自动上报的一个原因

原来如此!我后面在新包上面看看怎么加个选项来支持这种情况,谢谢!

这个新的核心包首次加载的时候会自动上报吗?我现在的方案是,如果首次加载则自动上报而不手动去上报,其他页面则是手动上报

from vue-cnzz-analytics.

chengpeiquan avatar chengpeiquan commented on June 29, 2024

这个新的核心包首次加载的时候会自动上报吗?我现在的方案是,如果首次加载则自动上报而不手动去上报,其他页面则是手动上报

不会的,因为它是为了给其它上层框架的包做基础功能支持(例如后面的 Vue 插件、VitePress 插件、React插件等),所以它没有提供额外的自动功能,需要手动调用 API 上报

from vue-cnzz-analytics.

Related Issues (3)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.