# era6-capacitor-analytics

> A capacitor plug-in that has enabled some features of Firebase Analytics

Latest version **0.0.5** (published 2020-03-19) · MIT license · 0 weekly downloads

## Install

```sh
npm install era6-capacitor-analytics
pnpm add era6-capacitor-analytics
yarn add era6-capacitor-analytics
bun add era6-capacitor-analytics
```

## 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.5 |
| Published | 2020-03-19 |
| First published | 2020-03-16 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | CommonJS |
| Dependencies | 1 |
| Unpacked size | 228.3 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Author | era6company |
| Maintainers | era6company, lindsey.tonn, lrebelo, marceloavan, sansao |
| Keywords | capacitor, plugin, native |

## Links

- npm: https://www.npmjs.com/package/era6-capacitor-analytics
- npm.io page: https://npm.io/package/era6-capacitor-analytics

## Dependencies (1)

- [@capacitor/core](https://npm.io/package/@capacitor/core.md) 2.0.0-beta.0

## Recent versions

- 0.0.5 (latest) — 2020-03-19
- 0.0.4 — 2020-03-17
- 0.0.3 — 2020-03-16
- 0.0.2 — 2020-03-16

## README

# Era6 Capacitor Analytics

A capacitor plug-in that has enabled some features of Firebase Analytics

## Android

- `npm install --save era6-capacitor-analytics`
- `npx cap sync android`
- `npx cap open android`
- Add the Firebase service configuration file to the app's root folder (`android/app`) - [doc](https://firebase.google.com/docs/android/setup#add-config-file)
- In your `MainActivity.java` file add the lines:
```java
    import br.com.era6.capacitor.analytics.CapacitorAnalyticsPlugin;

    ...

    add(CapacitorAnalyticsPlugin.class);
```

## iOS

- `npm install --save era6-capacitor-analytics`
- `npx cap sync ios`
- `npx cap open ios`
- Add the Firebase service configuration file to the app's root folder (`ios/App/App`) - [doc](https://firebase.google.com/docs/ios/setup#add-config-file)

## API

- `reset(): Promise<void>`
- `enable(): Promise<void>`
- `disable(): Promise<void>`
- `logEvent({ name: string; params?: object }): Promise<void>`
- `setUserProp({ key: string; value: string }): Promise<void>`

## Usage

```js
import { CapacitorAnalyticsPlugin } from 'era6-capacitor-analytics';

// Get a instance
const analytics = new CapacitorAnalyticsPlugin();

// User properties
analytics.setUserProp({
    key: 'gender',
    value: 'female'
});

// logEvent
analytics.logEvent({
    name: 'page_view',
    params: {
        page_path: './test/'
    }
});

// Reset firebase values
analytics.reset();

// Enable firebase analytics
analytics.enable();

// Disable firebase analytics
analytics.disable();
```

## Debug

[Validate your Google Analytics configuration with DebugView](https://support.google.com/firebase/answer/7201382?hl=pt&utm_id=ad&authuser=0)


## License

MIT

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