You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Apr 4, 2023. It is now read-only.
Copy file name to clipboardExpand all lines: README.md
+3-1Lines changed: 3 additions & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -13,6 +13,7 @@ For readability the supported features have been moved to their own README's:
13
13
*[Cloud Messaging](docs/MESSAGING.md)
14
14
*[Storage](docs/STORAGE.md)
15
15
*[Crash Reporting](docs/CRASHREPORTING.md)
16
+
*[Analytics](docs/ANALYTICS.md)
16
17
17
18
## NativeScript version
18
19
Please update to at least tns 2.1.0 to make plugin installation a little easier (otherwise you'll need to manually add an `applicationId` to `app/App_Resources/Android/app.gradle`).
@@ -136,7 +137,8 @@ firebase.init({
136
137
137
138
#### Pod dependency error
138
139
If you see an error like `Unable to satisfy the following requirements: Firebase (~> 3.3.0) required by Podfile`,
139
-
then check [issue 98](#98) which perfectly explains how to update your local Pod spec repo.
140
+
then check [issue 98](#98) which perfectly explains how to update your local Pod spec repo, or first try
141
+
to `tns platform remove ios && tns platform add ios`.
This plugin has had enalytics enabled since day 1 to collect usage and behavior data for your app. However, you were not able to push your own events. That changed with version 3.6.0 😃🔥
5
+
6
+
_Beware that your Analytics events in the Firebase console dashboards are updated periodically throughout the day, not real-time._
7
+
8
+
9
+
## Functions
10
+
11
+
### analytics.logEvent
12
+
Events can be used to analyze what is happening in your app, such as user actions, system events, or errors.
13
+
14
+
Analytics automatically logs [some events](https://support.google.com/firebase/answer/6317485) for you; you don't need to add any code to receive them. If your app needs to collect additional data, you can log up to 500 different Analytics Event types in your app. There is no limit on the total volume of events your app logs.
15
+
16
+
For a list of predefined Events [check this Android reference](https://firebase.google.com/docs/reference/android/com/google/firebase/analytics/FirebaseAnalytics.Event.html). Just copy the String values - these are also available on iOS.
17
+
18
+
```js
19
+
firebase.analytics.logEvent({
20
+
key:"add_to_cart",
21
+
parameters: [ // optional
22
+
{
23
+
key:"item_id",
24
+
value:"p7654"
25
+
},
26
+
{
27
+
key:"item_name",
28
+
value:"abc"
29
+
}]
30
+
}).then(
31
+
function () {
32
+
console.log("Firebase Analytics event logged");
33
+
}
34
+
);
35
+
```
36
+
37
+
### analytics.setUserProperty
38
+
User properties are attributes you define to describe segments of your userbase, such as language preference or geographic location.
39
+
40
+
Analytics automatically logs [some user properties](https://support.google.com/firebase/answer/6317486); you don't need to add any code to enable them. If your app needs to collect additional data, you can set up to 25 different Analytics User Properties in your app.
41
+
42
+
You own properties need to be [preregistered with Firebase](https://support.google.com/firebase/answer/6317519?hl=en&ref_topic=6317489#create-property) before you can use them, so add a property for __all relevant platforms__ like this:
0 commit comments