0.0.5 • Published 5 years ago

era6-capacitor-analytics v0.0.5

Weekly downloads
-
License
MIT
Repository
-
Last release
5 years ago

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
  • In your MainActivity.java file add the lines:
    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

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

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

License

MIT

0.0.5

5 years ago

0.0.4

5 years ago

0.0.3

5 years ago

0.0.2

5 years ago

0.0.1

5 years ago