Open ajouve opened 9 hours ago
π€ Hmm, going to be quite the run-around on this one unfortunately, since we're comparing two cloud-based + different google services (google ads, firebase analytics) and it's wrapped by this library which both of them are suspicious of since they don't control it.
Here's what I know based on your helpful information - those two events are marked as reserved for us - that is no user may use an analytics API here which attempts to manually log them:
So, we do not even let users log those events, full stop. Nothing in this library allows for those events to be used, they are off-limits.
In a full-repo search, the app_store_subscription_convert
event is not used in any other spot:
My informed hypothesis is that this library is not involved in sending that conversion information to google servers at all.
To explore this a bit more - looking more widely for the words convert or conversion do not yield anything analytics related either:
https://github.com/search?q=repo%3Ainvertase%2Freact-native-firebase+convert+language%3AJava&type=code&l=Java https://github.com/search?q=repo%3Ainvertase%2Freact-native-firebase+conversion+language%3AJava&type=code&l=Java
Looking upstream, these are classed as "automatically collected events", and they have had problems before:
https://github.com/firebase/firebase-android-sdk/issues/2179
Indeed these are marked as automatically collected: https://support.google.com/analytics/answer/9234069?hl=en&visit_id=638660672837317251-375485086&rd=2
That is, the SDKs under us - firebase-android-sdk in this case - are doing it for us with no part of this repository doing anything
So I don't think this is a problem here
However, this tidbit is interesting:
According to Google Analytics, many pings are "unattributed" in Firebase, suggesting potential issues with SDK implementation
The more (and more technical) information we could get about that, the more it would help determine what this means, and whether we could influence it. Unfortunately I'm not even sure what it means at a technical level at the moment
Possible ways forward: 1- get that technical info - as specific as possible - about unattributed pings 2- construct reproduction rig that is firebase-android-sdk only, removing this layer, to inspect attribution. Can be done with fresh app + fresh cloud accounts and products that are very low-cost or zero I hope - allowing for clean + focused reproduction without the finger-pointing that is unfortunately inevitable when those teams here "react-native"
Of the 2 - 1 is of interest here but I don't think will actually resolve your issue. I think 2 is the real way forward
This may be the best skeleton to begin with: https://github.com/firebase/quickstart-android/blob/master/analytics/README.md
then just hack in (the most rapid way possible) buttons that subscribe and cancel ?
Issue
Description:
Hello React Native Firebase team,
Weβre experiencing a significant data discrepancy between Firebase and Google Ads for specific conversion events in our app, built with the React Native Firebase SDK. We have thoroughly reviewed our integration, followed the documentation meticulously, and ensured our events are set up correctly. Despite this, only about 30% of our conversion events are reflected in Google Ads reporting compared to Firebase.
Event Details:
The specific events affected are:
in_app_purchase
Background from Google Analytics and Firebase Support:
We have reached out to both Google Analytics and Firebase Support, who have reviewed our setup and provided the following insights:
Google Analytics Feedback: According to Google Analytics, many pings are "unattributed" in Firebase, suggesting potential issues with SDK implementation. They recommended consulting the Firebase support team or React Native Firebase community due to limited expertise with React Native SDKs.
Firebase Support Feedback: Firebase Support confirmed our Google Ads and Firebase are correctly linked, and our events show a "google" source, indicating they should be attributed to Google Ads. They noted that React Native Firebase is not an official Firebase SDK, so issues could stem from its external nature. They suggested exploring attribution nuances or consulting Google Analytics further for historical data and configuration details.
Request:
Could you provide any guidance or insights into what might cause these unattributed pings in the React Native Firebase SDK? Is there anything specific to this SDK that could result in this significant data drop-off or the unattribution issue?
We appreciate any assistance or advice on resolving this discrepancy. Thank you for your support and for providing a fantastic tool for integrating Firebase with React Native!
Additional Context:
We have confirmed that our setup aligns with all provided documentation, and we haven't omitted any configuration steps. At the moment most of our users are on Android, we are not able to confirm if the issue is also on iOS
Project Files
Javascript
Click To Expand
#### `package.json`: ```json { "name": "***", "version": "0.0.1", "private": true, "scripts": { "android": "react-native run-android", "ios": "react-native run-ios", "start": "react-native start", "test": "jest", "lint": "eslint .", "build:android": "(cd android;./gradlew clean) && (cd android;./gradlew bundleRelease)", "pod": "(cd ios;bundle install && bundle exec pod install --repo-update)", "plateform-version": "node bin/plateformVersion.js" }, "dependencies": { "@react-native-async-storage/async-storage": "^1.23.1", "@react-native-community/checkbox": "^0.5.17", "@react-native-firebase/analytics": "^21.3.0", "@react-native-firebase/app": "^21.3.0", "@react-native-firebase/crashlytics": "^21.3.0", "@react-navigation/native": "^6.1.18", "@react-navigation/native-stack": "^6.10.1", "@rneui/base": "^4.0.0-rc.7", "@rneui/themed": "^4.0.0-rc.8", "@sentry/react-native": "^5.24.1", "@shopify/flash-list": "^1.6.3", "country-telephone-data": "^0.6.3", "fetch-retry": "^6.0.0", "i18next": "^23.2.8", "moment": "^2.29.4", "phone": "^3.1.37", "react": "18.3.1", "react-i18next": "^13.0.2", "react-native": "0.75.2", "react-native-actions-sheet": "^0.9.3", "react-native-background-fetch": "^4.2.3", "react-native-contacts": "^7.0.8", "react-native-device-info": "^10.7.0", "react-native-fs": "^2.20.0", "react-native-geolocation-service": "^5.3.1", "react-native-gesture-handler": "^2.14.0", "react-native-image-crop-picker": "^0.41.2", "react-native-localize": "^3.0.6", "react-native-maps": "1.18.0", "react-native-onesignal": "^5.2.4", "react-native-open-maps": "^0.4.3", "react-native-permissions": "^4.1.5", "react-native-purchases": "^8.2.3", "react-native-rate": "^1.2.12", "react-native-safe-area-context": "^4.6.4", "react-native-screens": "^3.22.1", "react-native-svg": "^13.10.0", "yargs": "^17.7.2" }, "devDependencies": { "@babel/core": "^7.20.0", "@babel/preset-env": "^7.20.0", "@babel/runtime": "^7.20.0", "@react-native/babel-preset": "0.75.2", "@react-native/eslint-config": "0.75.2", "@react-native/metro-config": "0.75.2", "@react-native/typescript-config": "0.75.2", "@types/react": "^18.2.6", "@types/react-test-renderer": "^18.0.0", "babel-jest": "^29.6.3", "eslint": "^8.19.0", "jest": "^29.6.3", "prettier": "2.8.8", "react-test-renderer": "18.3.1", "typescript": "5.0.4" }, "engines": { "node": ">=18" }, "packageManager": "yarn@3.6.4" } ``` #### `firebase.json` for react-native-firebase v6: ```json # N/A ```
iOS
Click To Expand
#### `ios/Podfile`: - [ ] I'm not using Pods - [x] I'm using Pods and my Podfile looks like: ```ruby # Resolve react_native_pods.rb with node to allow for hoisting def node_require(script) # Resolve script with node to allow for hoisting require Pod::Executable.execute_command('node', ['-p', "require.resolve( '#{script}', {paths: [process.argv[1]]}, )", __dir__]).strip end node_require('react-native/scripts/react_native_pods.rb') node_require('react-native-permissions/scripts/setup.rb') platform :ios, 14 prepare_react_native_project! setup_permissions([ # 'AppTrackingTransparency', # 'Bluetooth', # 'Calendars', # 'CalendarsWriteOnly', 'Camera', 'Contacts', # 'FaceID', 'LocationAccuracy', 'LocationAlways', 'LocationWhenInUse', 'MediaLibrary', # 'Microphone', # 'Motion', 'Notifications', 'PhotoLibrary', # 'PhotoLibraryAddOnly', # 'Reminders', # 'Siri', # 'SpeechRecognition', # 'StoreKit', ]) linkage = ENV['USE_FRAMEWORKS'] if linkage != nil Pod::UI.puts "Configuring Pod with #{linkage}ally linked Frameworks".green use_frameworks! :linkage => linkage.to_sym end target 'AppGeolocNative' do # React Native Maps dependencies rn_maps_path = '../node_modules/react-native-maps' pod 'react-native-google-maps', :path => rn_maps_path config = use_native_modules! # https://rnfirebase.io/ use_frameworks! :linkage => :static $RNFirebaseAsStaticFramework = true $RNFirebaseAnalyticsEnableAdSupport = true use_react_native!( :path => config[:reactNativePath], # An absolute path to your application root. :app_path => "#{Pod::Config.instance.installation_root}/.." ) target 'AppGeolocNativeTests' do inherit! :complete # Pods for testing end post_install do |installer| # https://github.com/facebook/react-native/blob/main/packages/react-native/scripts/react_native_pods.rb#L197-L202 react_native_post_install( installer, config[:reactNativePath], :mac_catalyst_enabled => false, # :ccache_enabled => true ) end end target 'OneSignalNotificationServiceExtension' do # https://rnfirebase.io/ use_frameworks! :linkage => :static $RNFirebaseAsStaticFramework = true pod 'OneSignalXCFramework', '>= 5.0.0', '< 6.0' end ``` #### `AppDelegate.m`: ```objc #import "AppDelegate.h" #import
#import
#import
#import
@implementation AppDelegate
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
[FIRApp configure];
[GMSServices provideAPIKey:@"xxx"];
NSURL *jsCodeLocation;
// [REQUIRED] Register BackgroundFetch
[[TSBackgroundFetch sharedInstance] didFinishLaunching];
[UIDevice currentDevice].batteryMonitoringEnabled = true;
self.moduleName = @"AppGeolocNative";
// You can add your custom initial props in the dictionary below.
// They will be passed down to the ViewController used by React Native.
self.initialProps = @{};
return [super application:application didFinishLaunchingWithOptions:launchOptions];
}
- (NSURL *)sourceURLForBridge:(RCTBridge *)bridge
{
return [self bundleURL];
}
- (NSURL *)bundleURL
{
#if DEBUG
return [[RCTBundleURLProvider sharedSettings] jsBundleURLForBundleRoot:@"index"];
#else
return [[NSBundle mainBundle] URLForResource:@"main" withExtension:@"jsbundle"];
#endif
}
@end
```
Android
Click To Expand
#### Have you converted to AndroidX? - [ ] my application is an AndroidX application? - [ ] I am using `android/gradle.settings` `jetifier=true` for Android compatibility? - [ ] I am using the NPM package `jetifier` for react-native compatibility? #### `android/build.gradle`: ```groovy // Top-level build file where you can add configuration options common to all sub-projects/modules. buildscript { ext { buildToolsVersion = "34.0.0" minSdkVersion = 23 compileSdkVersion = 34 targetSdkVersion = 34 ndkVersion = "26.1.10909125" kotlinVersion = "1.9.24" // https://stackoverflow.com/questions/77274148/could-not-invoke-rnfusedlocation-getcurrentposition-react-native-geolocation-s playServicesLocationVersion = "21.0.1" } repositories { google() mavenCentral() } dependencies { classpath("com.android.tools.build:gradle") classpath("com.facebook.react:react-native-gradle-plugin") classpath("org.jetbrains.kotlin:kotlin-gradle-plugin") // https://rnfirebase.io/ classpath 'com.google.gms:google-services:4.4.2' // https://rnfirebase.io/crashlytics/android-setup classpath 'com.google.firebase:firebase-crashlytics-gradle:2.9.9' } } // react-native-background-fetch allprojects { repositories { maven { url("${project(':react-native-background-fetch').projectDir}/libs") } } } apply plugin: "com.facebook.react.rootproject" ``` #### `android/app/build.gradle`: ```groovy apply plugin: "com.android.application" // https://rnfirebase.io/ apply plugin: 'com.google.gms.google-services' apply plugin: "org.jetbrains.kotlin.android" apply plugin: "com.facebook.react" // https://rnfirebase.io/crashlytics/android-setup apply plugin: 'com.google.firebase.crashlytics' /** * This is the configuration block to customize your React Native Android app. * By default you don't need to apply any configuration, just uncomment the lines you need. */ react { /* Folders */ // The root of your project, i.e. where "package.json" lives. Default is '../..' // root = file("../../") // The folder where the react-native NPM package is. Default is ../../node_modules/react-native // reactNativeDir = file("../../node_modules/react-native") // The folder where the react-native Codegen package is. Default is ../../node_modules/@react-native/codegen // codegenDir = file("../../node_modules/@react-native/codegen") // The cli.js file which is the React Native CLI entrypoint. Default is ../../node_modules/react-native/cli.js // cliFile = file("../../node_modules/react-native/cli.js") /* Variants */ // The list of variants to that are debuggable. For those we're going to // skip the bundling of the JS bundle and the assets. By default is just 'debug'. // If you add flavors like lite, prod, etc. you'll have to list your debuggableVariants. // debuggableVariants = ["liteDebug", "prodDebug"] /* Bundling */ // A list containing the node command and its flags. Default is just 'node'. // nodeExecutableAndArgs = ["node"] // // The command to run when bundling. By default is 'bundle' // bundleCommand = "ram-bundle" // // The path to the CLI configuration file. Default is empty. // bundleConfig = file(../rn-cli.config.js) // // The name of the generated asset file containing your JS bundle // bundleAssetName = "MyApplication.android.bundle" // // The entry file for bundle generation. Default is 'index.android.js' or 'index.js' // entryFile = file("../js/MyApplication.android.js") // // A list of extra flags to pass to the 'bundle' commands. // See https://github.com/react-native-community/cli/blob/main/docs/commands.md#bundle // extraPackagerArgs = [] /* Hermes Commands */ // The hermes compiler command to run. By default it is 'hermesc' // hermesCommand = "$rootDir/my-custom-hermesc/bin/hermesc" // // The list of flags to pass to the Hermes compiler. By default is "-O", "-output-source-map" // hermesFlags = ["-O", "-output-source-map"] /* Autolinking */ autolinkLibrariesWithApp() } /** * Set this to true to create four separate APKs instead of one, * one for each native architecture. This is useful if you don't * use App Bundles (https://developer.android.com/guide/app-bundle/) * and want to have separate APKs to upload to the Play Store. */ def enableSeparateBuildPerCPUArchitecture = false /** * Set this to true to Run Proguard on Release builds to minify the Java bytecode. */ def enableProguardInReleaseBuilds = false /** * The preferred build flavor of JavaScriptCore (JSC) * * For example, to use the international variant, you can use: * `def jscFlavor = 'org.webkit:android-jsc-intl:+'` * * The international variant includes ICU i18n library and necessary data * allowing to use e.g. `Date.toLocaleString` and `String.localeCompare` that * give correct results when using with locales other than en-US. Note that * this variant is about 6MiB larger per architecture than default. */ def jscFlavor = 'org.webkit:android-jsc:+' /** * Private function to get the list of Native Architectures you want to build. * This reads the value from reactNativeArchitectures in your gradle.properties * file and works together with the --active-arch-only flag of react-native run-android. */ def reactNativeArchitectures() { def value = project.getProperties().get("reactNativeArchitectures") return value ? value.split(",") : ["armeabi-v7a", "x86", "x86_64", "arm64-v8a"] } android { ndkVersion rootProject.ext.ndkVersion buildToolsVersion rootProject.ext.buildToolsVersion compileSdk rootProject.ext.compileSdkVersion namespace "com.majx.geoloc" defaultConfig { applicationId "com.majx.geoloc" minSdkVersion rootProject.ext.minSdkVersion targetSdkVersion rootProject.ext.targetSdkVersion versionCode 182 versionName "2.0.4" missingDimensionStrategy "store", "play" vectorDrawables.useSupportLibrary = true } splits { abi { reset() enable enableSeparateBuildPerCPUArchitecture universalApk false // If true, also generate a universal APK include (*reactNativeArchitectures()) } } signingConfigs { release { if (project.hasProperty('MYAPP_UPLOAD_STORE_FILE')) { storeFile file(MYAPP_UPLOAD_STORE_FILE) storePassword MYAPP_UPLOAD_STORE_PASSWORD keyAlias MYAPP_UPLOAD_KEY_ALIAS keyPassword MYAPP_UPLOAD_KEY_PASSWORD } } debug { storeFile file('debug.keystore') storePassword 'android' keyAlias 'androiddebugkey' keyPassword 'android' } } buildTypes { debug { signingConfig signingConfigs.debug } release { // Caution! In production, you need to generate your own keystore file. // see https://reactnative.dev/docs/signed-apk-android. signingConfig signingConfigs.release minifyEnabled enableProguardInReleaseBuilds proguardFiles getDefaultProguardFile("proguard-android.txt"), "proguard-rules.pro" } } // applicationVariants are e.g. debug, release applicationVariants.all { variant -> variant.outputs.each { output -> // For each separate APK per architecture, set a unique version code as described here: // https://developer.android.com/studio/build/configure-apk-splits.html // Example: versionCode 1 will generate 1001 for armeabi-v7a, 1002 for x86, etc. def versionCodes = ["armeabi-v7a": 1, "x86": 2, "arm64-v8a": 3, "x86_64": 4] def abi = output.getFilter(com.android.build.OutputFile.ABI) if (abi != null) { // null for the universal-debug, universal-release variants output.versionCodeOverride = defaultConfig.versionCode * 1000 + versionCodes.get(abi) } } } } dependencies { // The version of react-native is set by the React Native Gradle Plugin implementation("com.facebook.react:react-android") if (hermesEnabled.toBoolean()) { implementation("com.facebook.react:hermes-android") } else { implementation jscFlavor } } ``` #### `android/settings.gradle`: ```groovy pluginManagement { includeBuild("../node_modules/@react-native/gradle-plugin") } plugins { id("com.facebook.react.settings") } extensions.configure(com.facebook.react.ReactSettingsExtension){ ex -> ex.autolinkLibrariesFromCommand() } rootProject.name = 'xxx' include ':app' includeBuild('../node_modules/@react-native/gradle-plugin') ``` #### `MainApplication.kt`: ```kt package com.company.project import android.app.Application import com.facebook.react.PackageList import com.facebook.react.ReactApplication import com.facebook.react.ReactHost import com.facebook.react.ReactNativeHost import com.facebook.react.ReactPackage import com.facebook.react.defaults.DefaultNewArchitectureEntryPoint.load import com.facebook.react.defaults.DefaultReactHost.getDefaultReactHost import com.facebook.react.defaults.DefaultReactNativeHost import com.facebook.soloader.SoLoader class MainApplication : Application(), ReactApplication { override val reactNativeHost: ReactNativeHost = object : DefaultReactNativeHost(this) { override fun getPackages(): List =
PackageList(this).packages.apply {
// Packages that cannot be autolinked yet can be added manually here, for example:
// add(MyReactNativePackage())
}
override fun getJSMainModuleName(): String = "index"
override fun getUseDeveloperSupport(): Boolean = BuildConfig.DEBUG
override val isNewArchEnabled: Boolean = BuildConfig.IS_NEW_ARCHITECTURE_ENABLED
override val isHermesEnabled: Boolean = BuildConfig.IS_HERMES_ENABLED
}
override val reactHost: ReactHost
get() = getDefaultReactHost(applicationContext, reactNativeHost)
override fun onCreate() {
super.onCreate()
SoLoader.init(this, false)
if (BuildConfig.IS_NEW_ARCHITECTURE_ENABLED) {
// If you opted-in for the New Architecture, we load the native entry point for this app.
load()
}
}
}
```
#### `AndroidManifest.xml`:
```xml
```
Environment
Click To Expand
**`react-native info` output:** ``` System: OS: macOS 14.6.1 CPU: (12) arm64 Apple M2 Max Memory: 3.66 GB / 64.00 GB Shell: version: "5.9" path: /bin/zsh Binaries: Node: version: 20.11.1 path: /opt/homebrew/opt/node@20/bin/node Yarn: Not Found npm: version: 10.2.4 path: /opt/homebrew/opt/node@20/bin/npm Watchman: version: 2024.05.06.00 path: /opt/homebrew/bin/watchman Managers: CocoaPods: version: 1.14.3 path: /Users/ajouve/.rvm/gems/ruby-2.7.5/bin/pod SDKs: iOS SDK: Platforms: - DriverKit 24.1 - iOS 18.1 - macOS 15.1 - tvOS 18.1 - visionOS 2.1 - watchOS 11.1 Android SDK: Not Found IDEs: Android Studio: 2022.3 AI-223.8836.35.2231.10671973 Xcode: version: 16.1/16B40 path: /usr/bin/xcodebuild Languages: Java: version: 22.0.1 path: /opt/homebrew/opt/openjdk/bin/javac Ruby: version: 2.7.5 path: /Users/ajouve/.rvm/rubies/ruby-2.7.5/bin/ruby npmPackages: "@react-native-community/cli": installed: 15.0.1 wanted: ^15.0.1 react: installed: 18.3.1 wanted: 18.3.1 react-native: installed: 0.75.2 wanted: 0.75.2 react-native-macos: Not Found npmGlobalPackages: "*react-native*": Not Found Android: hermesEnabled: Not found newArchEnabled: Not found iOS: hermesEnabled: Not found newArchEnabled: Not found ``` - **Platform that you're experiencing the issue on**: - [ ] iOS - [ ] Android - [ ] **iOS** but have not tested behavior on Android - [x] **Android** but have not tested behavior on iOS - [ ] Both - **`react-native-firebase` version you're using that has this issue:** - `21.3.0` - **`Firebase` module(s) you're using that has the issue:** - `analytics` - **Are you using `TypeScript`?** - `N`
React Native Firebase
andInvertase
on Twitter for updates on the library.