Owner: Thomas Pucci
- React Native Firebase is installed on your project
- You want to track one event
Validating events tracking with Firebase should be done with two tickets:
- You should have one ticket to send the event to Firebase which your PO will validate with a screenshot.
- You should have a second ticket to track your event and its parameters on Firebase and save it (this ticket is dependant of the previous one and can be treated one day after the first ticket is completed).
Example:
Choose to start with either Android or iOS. Once you've finished with an OS, switch to the other.
- in Xcode, edit the product's scheme.
{% hint style='info' %}
Go in Product, Scheme ▶, Edit Scheme... ⌘< or use the shortcut ⌘<.
{% endhint %}
- In the left menu, select Run. Select the Arguments tab.
- In the Arguments passed on launch section, click the + icon (Add items).
- Type in
-FIRDebugEnabled
and hit enter. - Close the modal.
- Build your application and run it on your simulator or device.
{% hint style='success' %} CHECK
- In Firebase, in the left menu, go in Analytics, Debug View.
- Select your application in the top menu.
- Your debug devices count should print: APPAREIL DE DÉBOGAGE: 1
{% endhint %}
- Run your simulator or connect your device.
{% hint style='success' %} CHECK
Running the command adb devices
in your shell should display your device ID.
List of devices attached
emulator-5554 device
{% endhint %}
- Run the following command:
adb shell setprop debug.firebase.analytics.app <package_name>
{% hint style='success' %} CHECK
- In Firebase, in the left menu, go in Analytics, Debug View.
- Select your application in the top menu.
- Your debug devices count should print: APPAREIL DE DÉBOGAGE: 1
{% endhint %}
- Use
logEvent
method.
Exemple:
import firebase from "react-native-firebase";
const firebaseAnalytics = firebase.analytics();
export default class Analytics {
static trackEvent(eventName, params) {
firebaseAnalytics.logEvent(eventName, params);
}
}
- In your simulator or on your device, do the action which rises the event.
{% hint style='success' %} CHECK:
- In Firebase, in the left menu, go in Analytics, Debug View.
- Select your application in the top menu.
- You should see your events with their parameters
{% endhint %}
- (bis) Do the same for Android and iOS.
-
Take a screenshot of the event(s) with their parameters your ticket aims to implement. (To see the parameters received by Firebase, click on one event)
-
Commit your work except all modifications to
<your_project>.xcodeproj
-
Create your pull request
-
Once merged, attach your screenshot to your first ticket which aims to track the event.
-
Deploy your changes, and do the action which rises the event on your Staging Application.
-
Put your first ticket to validation and add a due date to the second ticket to tomorrow.
-
In Firebase, in the left menu, go in Analytics, Events.
-
Check that your event is in the list. If not, either something went wrong in the previous steps either Google has not reported any events yet (or Google is down).
-
To track parameter, click on your event then on the 'Add parameters' button.
Either stash your changes on <your_project>.xcodeproj
or do the following:
- in Xcode, edit the product's scheme.
{% hint style='info' %}
Go in Product, Scheme ▶, Edit Scheme... ⌘< or use the shortcut ⌘<.
{% endhint %}
- In the left menu, select Run. Select the Arguments tab.
- In the Arguments passed on launch section, remove
-FIRDebugEnabled
click the + icon (Add items). - Type in
-FIRDebugDisabled
and hit enter. - Close the modal.
- Build your application and run it on your simulator or device.
{% hint style='success' %} CHECK
- In Firebase, in the left menu, go in Analytics, Debug View.
- Select your application in the top menu.
- Your debug devices count should print: APPAREIL DE DÉBOGAGE: 0
{% endhint %}
- Reload the app in your simulator or your device.
{% hint style='success' %} CHECK
Running the command adb devices
in your shell should display your device ID.
List of devices attached
emulator-5554 device
{% endhint %}
- Run the following command:
adb shell setprop debug.firebase.analytics.app .none.
{% hint style='success' %} CHECK:
- In Firebase, in the left menu, go in Analytics, Debug View.
- Select your application in the top menu.
- Your debug devices count should print: APPAREIL DE DÉBOGAGE: 0
{% endhint %}