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 🙏

© 2024 – Pkg Stats / Ryan Hefner

nativescript-fb-analytics

v1.0.3

Published

Lightweight NativeScript plugin to add Facebook Analytics to iOS and Android apps

Downloads

8

Readme

Nativescript: Facebook Analytics

Adds only Facebook Analytics to your Nativescript app not the full Facebook SDK.

This plugin is based on nativescript-facebook but only includes the Facebook Core Library which is needed for analytics. This way it reduces the bundle size by 86% compared to nativescript-facebook which includes the full Facebook SDK. If you want to learn more you may read this blog post.

Installation

tns plugin add nativescript-fb-analytics

Configuration

The following configuration is needed in order to get started with Facebook Analytics. In order to obtain a Facebook App-ID please refer to the official documentation.

Initialize the plugin before calling app.run:

/* your-project/app/app.ts */
import * as app from "tns-core-modules/application";
import * as fbAnalytics from 'nativescript-fb-analytics';

app.on(app.launchEvent, function (args) {
    fbAnalytics.initAnalytics();
});

Additional configs needed for Android:

<!--your-project/app/App_Resources/Android/src/main/res/values/strings.xml-->
<string name="facebook_app_id">YOUR_APP_ID</string>


<!--your-project/app/App_Resources/Android/src/main/res/AndroidManifest.xml-->
<application
	android:name="com.tns.NativeScriptApplication"
	android:allowBackup="true"
	android:icon="@drawable/icon"
	android:label="@string/app_name"
	android:theme="@style/AppTheme">
    
    <meta-data android:name="com.facebook.sdk.ApplicationId" android:value="@string/facebook_app_id"/>
	...
</application>

Additional configs needed for iOS:

<!--your-project/app/App_Resources/iOS/Info.plist-->
<key>CFBundleURLTypes</key>
<array>
  <dict>
    <key>CFBundleURLSchemes</key>
      <array>
        <string>fbYOUR_APP_ID</string>
      </array>
  </dict>
</array>
<key>FacebookAppID</key>
<string>YOUR_APP_ID</string>
<key>FacebookDisplayName</key>
<string>YOUR_APP_NAME</string>

Usage

You can log events from anywhere you want by importing

import * as fbAnalytics from 'nativescript-fb-analytics';

and calling

fbAnalytics.logEvent('Lead');

You may also add parameters to your event logging:

const value = 5;
const parameters = [{
    key: 'value',
    value: value.toString(),
}];

fbAnalytics.logEvent(FundsAdded, parameters);