wechat-matomo

3.9.7 • Public • Published

wechat-matomo

// 模板消息类事件: // 二、三参数取值: 二: msgTemplateId=${msgTemplateId}, // 后端模板消息提供 三: shareFrom=${channelId(user_event.branch)},// 后端模板消息提供 this.$parent.$wxapp.matomo.trackEvent('msg', msgTemplateId=${msgTemplateId}, shareFrom=${channelId(user_event.branch)})

// 授权手机号事件: // 二、三参数取值: 1、模板消息:msgTemplateId=${msgTemplateId}, shareFrom=${channelId(user_event.branch)}, 参数取值规则与模板消息类一致 2、其他:default, default, 后期有其他类型参考模板消息扩展 this.$parent.$wxapp.matomo.trackEvent(auth_phone, , )

npm

Link your Piwik/Matomo installation

Installation

npm install --save wechat-matomo

Usage

init

/**
 * 注意初始化动作需要再 app class 执行之前初始化,否则无法自动追踪App生命周期事件
 *    trackerApiUrl:
 *      生产:待定
 *      测试:http://172.18.62.201:7080/piwik.php
 *    siteId:
 *      生产:待定,每个应用申请一个
 *      测试:1
 */
app.js

import mamoto from 'wechat-matomo'
const pageTitles = { // 页面标题翻译
  'pages/home/index': '页面标题1111',
   ……
}
matomo.initTracker(reportUrl, siteId, { pageTitles })

export default class extends wepy.app {
  config = {
    pages: [
      'pages/home/index',

through

/**
 * 用户绑定
 * eg:
 *  this.$parent.$wxapp.matomo.setUserId(11123)
 */
this.$parent.$wxapp.matomo.setUserId(userId or email)

/**
 * 用户解绑, 小程序一般不需要
 * eg:
 *  this.$parent.$wxapp.matomo.resetUserId()
 */
this.$parent.$wxapp.matomo.resetUserId()  

/**
 * 自定义事件追踪
 * eg:
 *  this.$parent.$wxapp.matomo.trackEvent('商城', '商品分享', '商品名称', 1)
 * category: 事件分类
 * action: 动作
 * name: 具体目标名称, 非必填
 * num: 事件动作的数值型参数,非必填,数值类型
 */
this.$parent.$wxapp.matomo.trackEvent('category', 'action', 'name', num)

/**
 * 自定义页面追踪
 * 正常小程序页面会自动追踪page.onLoad页面事件进行上报,其他页面需手动上报
 * eg:
 *  this.matomo.trackPageView('直播页', 'pages/plan/index')
 * customUrl: 自定义页面链接,与小程序页面path格式一致即可
 */
this.$parent.$wxapp.matomo.trackPageView(pageTile, customUrl)

For available operations see the matomo api docs

License

MIT

Readme

Keywords

none

Package Sidebar

Install

npm i wechat-matomo

Weekly Downloads

22

Version

3.9.7

License

MIT

Unpacked Size

165 kB

Total Files

8

Last publish

Collaborators

  • liudapeng