npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

mars-mta

v0.0.2

Published

a vue plugin for MTA

Downloads

3

Readme

mars-mta

针对MTA(腾讯移动分析)的Vue插件

Introduction

mars-mta是针对MTA(腾讯移动分析)的vue插件,可直接使用.

安装方法

全局安装

$ npm i mars-mta --save
// main.js
import Mars from 'mars-mta'
  Vue.use(Mars, {
    open: true, // 开关,若为false,则不会发出上报
    config: {
      sid: '', // 必填,统计用的appid
      cid: '', // 如果开启自定义事件,此项目为必填,否则不填
      autoReport: 0, // 是否开启自动上报(1:init完成则上报一次,0:使用pgv方法才上报)
      senseHash: 1, // hash锚点是否进入url统计
      senseQuery: 0, // url参数是否进入url统计
      performanceMonitor: 0, // 是否开启性能监控
      ignoreParams: [] // 开启url参数上报时,可忽略部分参数拼接上报
    }
  })

API

stat(options)

上报事件的基本方法

全局安装

// page.vue
export default {
  name: 'page',
  data () {
    return {
    }
  },
  methods: {
    handleClick (log) {
      // 自助上报
      this.$stat({
        event: '', // 上报事件,
        data: {} // 附带事件数据
      })
    }
  },
  async created () {
  }
}
// page.vue
import { stat } from '...'
export default {
  name: 'page',
  data () {
    return {
    }
  },
  methods: {
    handleClick (log) {
      // 自助上报
      stat({
        type: '', // 事件类型
        link: '', // 上报链接
        event: '', // 上报事件
        title: '' // 事件标题
      })
    }
  },
  async created () {
  }
}

组件

mars-link

<mars-link>组件可以自动生成一个跳转前会上报事件的链接

<mars-link href="a.html" event="click_link" :data="{foo: '2333'}" class="link">链接</mars-link>

<mars-link tag="a" href="a.html"  event="click_link" class="link">
  <i></i>
  <p>链接</p>
</mars-link>

| 属性 | 说明 | 默认值 | | -------- | -----: | :----: | | tag | 标签 | a | | href | 跳转链接 | - | | event | 事件 | - | | data | 事件附带数据 | - |

mars-btn

<mars-btn>组件可以自动生成一个按钮类型的元素,点击会自动上报,可传入点击事件

<mars-btn event="click_link" :data="{foo: '2333'}" class="btn" @click="handleClick('2333')">按钮</mars-btn>

<mars-btn tag="button" event="click_link" class="btn" @click="handleClick('2333')">
  <i></i>
  <p>按钮</p>
</mars-btn>

属性

| 属性 | 说明 | 默认值 | | -------- | -----: | :----: | | tag | 标签 | a | | event | 事件 | - | | data | 事件附带数据 | - |

| 事件 | 说明 | | -------- | -----: | | click | 点击事件,不论有没有定义点击事件,都会上报. |