2.3.0 • Published 6 years ago

nuxt-matomo-v2 v2.3.0

Weekly downloads
2
License
ISC
Repository
github
Last release
6 years ago

nuxt 集成 matomo(原:piwik)

yarn add or npm installl nuxt-matomo-v2

引入到nuxt nuxt.config.js

modules: [
  ['nuxt-matomo-v2', {
    matomoUrl: '//da.23mofang.com/',
    siteId: 1, // 如果你的站点是静态的为 1 等等其他标识不变的情况下 这样设置
  }]
]

设置uid

添加 matomo_uid 字段到 store 中
store.state.matomo_uid = ${uid}

设置站点信息

  • 如果你的站点是静态的直接在 modules 中设置
  • 如果是动态的 你必须在 store 中设置一个 matomo_siteid 字段 值为你的站点标识
添加 matomo_siteid 字段到 store 中
store.state.matomo_siteid = ${siteid}

在 component 中使用

<template>
</template>

<script>
export default {
  matomo (from, to, store) {
    return {
      'event1': ['trackEvent', 'video', 'play']
    }
  }
}
</script>

在全局中使用

 _paq.push(['trackEvent', 'video', 'play']);
感谢 pimlie 提供的v1版本
2.3.0

6 years ago

2.2.1

6 years ago

2.2.0

6 years ago

2.1.0

6 years ago

2.0.0

6 years ago

1.0.0

6 years ago