Giter Site home page Giter Site logo

thesayyn / capacitor-plugin-facebook-analytics Goto Github PK

View Code? Open in Web Editor NEW

This project forked from spellchucker/capacitor-plugin-facebook-analytics

0.0 1.0 4.0 13.42 MB

Ruby 6.77% Java 44.27% Objective-C 6.81% Swift 26.50% JavaScript 3.09% TypeScript 12.55%

capacitor-plugin-facebook-analytics's Introduction

Installation

$ npm i --save capacitor-plugin-facebook-analytics

To use yarn

yarn add capacitor-plugin-facebook-analytics

Android configuration

In file android/app/src/main/java/**/**/MainActivity.java, add the plugin to the initialization list:

  this.init(savedInstanceState, new ArrayList<Class<? extends Plugin>>() {{
    [...]
+   add(com.vrba.plugins.facebookanalytics.FacebookAnalytics.class);
    [...]
  }});

In file android/app/src/main/AndroidManifest.xml, add the following XML elements under <manifest><application> :

+ <meta-data android:name="com.facebook.sdk.ApplicationId"
+     android:value="@string/facebook_app_id"/>

In file android/app/src/main/res/values/strings.xml add the following lines :

+ <string name="facebook_app_id">[APP_ID]</string>

Don't forget to replace [APP_ID] by your Facebook application Id.

More information can be found here: https://developers.facebook.com/docs/app-events/getting-started-app-events-android

iOS configuration

Add the following in the ios/App/App/info.plist file:

+ <key>FacebookAppID</key>
+ <string>[APP_ID]</string>
+ <key>FacebookDisplayName</key>
+ <string>[APP_NAME]</string>

More information can be found here: https://developers.facebook.com/docs/app-events/getting-started-app-events-ios

Supported methods

Name Android iOS Web
logEvent

API

logEvent

import { Plugins } from '@capacitor/core';
const { FacebookAnalytics } = Plugins;

// Example commands.
await FacebookAnalytics.logEvent(options: { event: string, params?: any }): Promise<string>;
await FacebookAnalytics.logPurchase(options: {amount: number, currency: string, params: any}): Promise<string>;
await FacebookAnalytics.logAddPaymentInfo(options: {success: number}): Promise<string>;
await FacebookAnalytics.logAddToCart(options: {amount: number, currency: string, params?: any}): Promise<string>;
await FacebookAnalytics.logCompleteRegistration(options: {params?: any}): Promise<string>;
await FacebookAnalytics.logInitiatedCheckout(options: {amount: number, params?: any}): Promise<string>;

capacitor-plugin-facebook-analytics's People

Contributors

kedarguy avatar spellchucker avatar thesayyn avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.