Skip to content

docs(firebase-analytics): update #194

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 7 commits into from
Apr 24, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
43 changes: 26 additions & 17 deletions packages/firebase-analytics/README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,21 @@
# @nativescript/firebase-analytics

* [Intro](#intro)
* [Installation](#installation)
* [Use @nativescript/firebase-analytics](#use-nativescriptfirebase-analytics)
* [Log custom events](#log-custom-events)
* [Log Predefined Events](#log-predefined-events)
* [Reserved Events](#reserved-events)
* [Get the app instance id](#get-the-appinstance-id)
* [Disable Ad Id usage on iOS](#disable-ad-id-usage-on-ios)
* [Demo app](#demo-app)
* [Analytics class](#analytics-class)
* [Properties](#properties)
* [Methods](#Methods)
* [License](#License)

## Intro

This plugin allows you to add [Google Analytics for Firebase](https://firebase.google.com/docs/analytics)
to your app.

Expand All @@ -13,18 +29,6 @@ Analytics collects usage and behavior data for your app. Its two primary concern

[![image](https://img.youtube.com/vi/8iZpH7O6zXo/hqdefault.jpg)](https://www.youtube.com/watch?v=8iZpH7O6zXo)

* [Installation](#installation)
* [Use @nativescript/firebase-analytics](#use-nativescriptfirebase-analytics)
* [Log custom events](#log-custom-events)
* [Log Predefined Events](#log-predefined-events)
* [Reserved Events](#reserved-events)
* [Get the app instance id](#get-the-appinstance-id)
* [Disable Ad Id usage on iOS](#disable-ad-id-usage-on-ios)
* [Analytics class API](#analytics-class-api)
* [Properties](#properties)
* [Methods](#Methods)
* [License](#License)

## Installation
Install the plugin by running the following command in the root directory of your project.

Expand All @@ -39,7 +43,8 @@ The examples below show you how to use `@nativescript/firebase-analytics` to log
### Log custom events

Analytics also allows developers to log custom events. If you're already familiar with Google Analytics, this method is equivalent to using the event command in [gtag.js](https://developers.google.com/gtagjs/).
To log a custom event to Analytics, call the `logEvent` method on an instance of the `Analytics` class passing it the name of the custom event as the first argument and the event data object as the second argument.

To log a custom event to Analytics, call the `logEvent` method on an instance of the [Analytics](#analytics-class) class passing it the name of the custom event as the first argument and the event data object as the second argument.

Please be aware that primitive data types or arrays of primitive data types are logged in your Firebase Analytics console.

Expand Down Expand Up @@ -105,9 +110,9 @@ import { firebase } from '@nativescript/firebase-core';
const appInstanceId = firebase().analytics().getAppInstanceId();
```

### Disable Ad Id usage on iOS
### Disable Identifier for Advertisers usage with analytics on iOS

Apple strictly bans an app from being in the Kids category if the app accesses IDFA iOS symbols.
Apple strictly bans an app from being in the Kids category if the app accesses Identifier for Advertisers(IDFA) iOS symbols.

Additionally, if an app accesses IDFA iOS symbols, it must implement Apple's [App Tracking Transparency](https://developer.apple.com/documentation/apptrackingtransparency)(or `ATT`). However, if an app does not use IDFA and otherwise handles data in an ATT-compatible way, it eliminates this ATT requirement.

Expand All @@ -119,9 +124,13 @@ $NSFirebaseAnalyticsWithoutAdIdSupport = true

During pod install, using that variable installs a new `Analytics With No Ad Ids` pod that the firebase-ios-sdk team created, and allows both the use of Firebase Analytics in Kids Category apps and Firebase Analytics without needing the App Tracking Transparency handling (assuming no other parts of your app handles data in a way that requires ATT)

Note that for obvious reasons, configuring Firebase Analytics for use without IDFA is incompatible with AdMob.
>**Note** that configuring Firebase Analytics for use without IDFA is incompatible with AdMob.

### Demo app

You can find the demo app [here](https://stackblitz.com/edit/nativescript-stackblitz-templates-j2k32w?file=app/firebase-analytics-page.ts).

## Analytics class API
## Analytics class

The plugin offers you the Analytics class through which you can manage Firebase Analytics.
The Analytics class has the following properties and methods.
Expand Down
2 changes: 1 addition & 1 deletion packages/firebase-messaging-core/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ export declare class MessagingCore implements IMessagingCore {
static getInstance(): MessagingCore;

static readonly inForeground: boolean;

static readonly appDidLaunch: boolean;

getCurrentToken(): Promise<string>;
Expand Down