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 🙏

© 2026 – Pkg Stats / Ryan Hefner

mta-h5

v1.5.0

Published

mta的web端的sdk

Readme

mta的web端的sdk

本次更新点

(1)ts参数可以不用传,sdk里主动创建ts参数为当前时间(10位秒级)。
(2)enterPage()方法里已经主动调用了 ac为"PV"的事件,不用额外调用PV事件。
(3) 为方便使用,只暴露 register,cutRegister,up,enterPage,leavePage 五个api,内置事件只用在up方法中传对应的参数即可。

引用方式

#1.npm安装
npm install mta-h5
import mta from 'mta-h5'

#2.通过cdn资源路径直接引入,然后就会存在全局变量 mta
<script src="https://tiov.cdn-go.cn/lib/latest/mta-h5/mta-h5.min.js"></script>

API通用必传参数:(path和ts参数,已经在sdk中自行获取,无需调用方传入)

(1)appId : 应用的appId
(2)baseUrl : 请求上报的baseUrl,各个项目的baseUrl可能不一样,所以作为参数
(3)ac : 埋点行为标识(详见:https://docs.qq.com/sheet/DZEtXVXFocW1wd3Rt?tab=BB08J2)

特殊可选参数:

(1) paramsType :(默认值为"0",即不对参数做任何处理),如果执行mta.register({paramsType:'1'}),那么会将参数中的content对象字段,转换成"a=1&b=2..."这种连接字符串的形式,作为args字段名扩展到原参数上,再上报。

其他可选参数详见:https://docs.qq.com/sheet/DZHZsQlhCdEhLUHFk?tab=0zam46

全局注册固定参数,必须先全局注册appId参数和请求上报地址的baseUrl参数,其他参数不强制(后续调API可以省略已注册的参数)

//比如:
mta.register({appId:'XXXXXXXXX',baseUrl:'http://*******'})
//或者多参数
mta.register({appId:'XXX',baseUrl:'http://*******',uid:'XXX',api:'/xx/xx/xxx'})

去除全局注册固定参数

//比如:
mta.cutRegister('uid')
//或者多参数
mta.cutRegister('uid','uuid')

API - 进入和离开页面

#进入某个页面时
mta.enterPage()

#离开某个页面时
mta.leavePage()

API - 上报(传入已注册的全局参数以外的 所需上报的参数)

mta.up({...参数})

ac的取值详见:https://docs.qq.com/sheet/DZHZsQlhCdEhLUHFk?tab=BB08J2