Giter Club home page Giter Club logo

vuepress-plugin-umami-analytics's Introduction

vuepress-plugin-umami-analytics

VuePress

Version Downloads

VuePress v2 plugin for injecting Umami analytics script into your app code. Umami is a self-hosted, privacy-friendly alternative to Google Analytics.

Installation

npm install --save vuepress-plugin-umami-analytics

Usage

Add plugin to your VuePress config:

import { umamiAnalyticsPlugin } from 'vuepress-plugin-umami-analytics'

let isProd = process.env.NODE_ENV === 'production'

export default {
  plugins: [
    isProd
      ? umamiAnalyticsPlugin({
          /* options */
        })
      : [],
  ],
}

Options

For more details on the configuration of the tracker, see the official documentation.

id

  • Type: string

  • Required: true

  • Details:

    Add website to Umami analytics and get parameters from tracking code. Put data-website-id here.

src

  • Type: string

  • Required: true

  • Details:

    Link to Umami analytics script.

hostUrl

  • Type: string

  • Required: false

  • Default value: null

  • Details:

    Send data to this host instead of the one where the script is located.

autoTrack

  • Type: boolean

  • Required: false

  • Default value: true

  • Details:

    Set to false to disable tracking all pageviews and events.

doNotTrack

  • Type: boolean

  • Required: false

  • Default value: false

  • Details:

    Whether to respect the browser's Do Not Track setting.

cache

  • Type: boolean

  • Required: false

  • Default value: false

  • Details:

    Whether to cache some data to improve performance. Be careful, it will use session storage, you may have to inform your users.

domains

  • Type: string[]

  • Required: false

  • Default value: null

  • Details:

    Only run the tracker on the domains specified. With a null value, tracker is active everywhere.

Umami tracking code

Contribution

Pull requests are welcome.

vuepress-plugin-umami-analytics's People

Contributors

azat-io avatar phundrak avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

Forkers

phundrak

vuepress-plugin-umami-analytics's Issues

在主题 vuepress2-theme-hope 中插件不生效

您好,
我在https://theme-hope.vuejs.press主题中使用了这个插件放在了config,ts中并不生效。

import { defineUserConfig } from "vuepress";
import { cut } from "nodejs-jieba";
import { umamiAnalyticsPlugin } from 'vuepress-plugin-umami-analytics'
import { searchProPlugin } from "vuepress-plugin-search-pro"
import theme from "./theme.js";

export default defineUserConfig({
  base: "/",

  lang: "zh-CN",
  title: "运维开发绿皮书",
  description: "运维开发绿皮书,放置我的笔记、搜集、摘录、实践,保持好奇心。看文需谨慎,后果很严重。",

  theme,

  plugins: [
    umamiAnalyticsPlugin({
      id: "eecd3f56-5668-4c9e-b123-b2853b91a310",
      src: "https://analytics.umami.is/script.js"
    }),
  ],
});

实际上代码

<script async="" src="https://analytics.umami.is/script.js" data-website-id=eecd3f56-5668-4c9e-b123-b2853b91a310"></script>

并没有添加进代码中。

我认为这个是个bug

最后,再次感谢你的插件,很好用!

Vue package version mismatch

I get the following when performing:

yarn add vuepress-plugin-umami-analytics
yarn dev
  throw new Error(
  ^

Error:

Vue packages version mismatch:

- [email protected]
- [email protected]

This may cause things to work incorrectly. Make sure to use the same version for both.

    at Object.<anonymous> (C:\Users\User\WebstormProjects\buildonkilt\docs\node_modules\vue-server-renderer\index.js:8:9)
    at Module._compile (node:internal/modules/cjs/loader:1256:14)
    at Module._extensions..js (node:internal/modules/cjs/loader:1310:10)
    at Module.load (node:internal/modules/cjs/loader:1119:32)
    at Module._load (node:internal/modules/cjs/loader:960:12)
    at Module.require (node:internal/modules/cjs/loader:1143:19)
    at require (node:internal/modules/cjs/helpers:110:18)
    at Object.<anonymous> (C:\Users\User\WebstormProjects\buildonkilt\docs\node_modules\@vuepress\core\lib\node\build\index.js:11:34)
    at Module._compile (node:internal/modules/cjs/loader:1256:14)
    at Module._extensions..js (node:internal/modules/cjs/loader:1310:10)
    at Module.load (node:internal/modules/cjs/loader:1119:32)
    at Module._load (node:internal/modules/cjs/loader:960:12)
    at Module.require (node:internal/modules/cjs/loader:1143:19)
    at require (node:internal/modules/cjs/helpers:110:18)
    at Object.<anonymous> (C:\Users\User\WebstormProjects\buildonkilt\docs\node_modules\@vuepress\core\lib\node\App.js:21:22)
    at Module._compile (node:internal/modules/cjs/loader:1256:14)

Node.js v18.17.0
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.```

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.