# ga-mp-tracker

> Goolge Analytics 4 tracking for wechat miniprogram

Latest version **0.0.3** (published 2022-08-18) · ISC license · 0 weekly downloads

## Install

```sh
npm install ga-mp-tracker
pnpm add ga-mp-tracker
yarn add ga-mp-tracker
bun add ga-mp-tracker
```

## Health

**Score 20/100 (F)** — status: abandoned.

Positive: has types; no vulnerabilities.

Warnings: low downloads; no esm support; pre 1.0.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.0.3 |
| Published | 2022-08-18 |
| First published | 2022-08-18 |
| Weekly downloads | 0 |
| License | ISC |
| TypeScript types | bundled |
| Module format | CommonJS |
| Dependencies | 1 |
| Unpacked size | 15 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Author | 行歌 |
| Maintainers | mayupai |
| Keywords | ga4, wechat, uniapp, miniprogram, Google Analytics, measurement protocol |

## Links

- npm: https://www.npmjs.com/package/ga-mp-tracker
- Repository: https://github.com/imokya/ga-mp-tracker
- Issues: https://github.com/imokya/ga-mp-tracker/issues
- npm.io page: https://npm.io/package/ga-mp-tracker

## Dependencies (1)

- [fetch-jsonp](https://npm.io/package/fetch-jsonp.md) ^1.2.1

## Recent versions

- 0.0.3 (latest) — 2022-08-18
- 0.0.2 — 2022-08-18
- 0.0.1 — 2022-08-18

## README

## 在小程序中使用谷歌统计4
### 1.安装
```javascript
npm i ga-mp-tracker
```
### 2.设置全局实例
```js
import gaTracker from 'ga-mp-tracker'
const { GoogleAnalytics } = gaTracker
const ga = new GoogleAnalytics({
  measurement_id: 'xxx',
  api_secret: 'xxx'
})
Vue.prototype.$ga = ga
```
### 3.发送页面事件
```js
const { Event } = gaTracker
const event = new Event('page_view', {
page_title: '页面标题'
})
this.$ga.send(event)
```
### 4.发送自定义事件
```js
const { Event } = gaTracker
const event = new Event('event_name', params)
this.$ga.send(event)
```

---
_Source: https://npm.io/package/ga-mp-tracker · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
