invertase / react-native-firebase

πŸ”₯ A well-tested feature-rich modular Firebase implementation for React Native. Supports both iOS & Android platforms for all Firebase services.
https://rnfirebase.io
Other
11.73k stars 2.22k forks source link

"items" param is not being shown in firebase console #4018

Closed ghost closed 4 years ago

ghost commented 4 years ago

Issue

Following the Docs we have a bunch of events that accept items param, according to the documentation it is an array of Item where all properties are optional.

Here are 3 exemples of that in the docs:

AddToCartEventParameters: https://rnfirebase.io/reference/analytics/addtocarteventparameters AddToWishlistEventParameters: https://rnfirebase.io/reference/analytics/addtowishlisteventparameters BeginCheckoutEventParameters: https://rnfirebase.io/reference/analytics/begincheckouteventparameters

On begin checkout for exemple I'm sending the params like that:

  {
    "currency": "BRL",
    "items": [
      {
        "item_brand": "Item Brand",
        "item_category": "shoe",
        "item_id": "S0158DF0FF20000U",
        "item_name": "Espadrille",
        "item_variant": "S0158DF0FF20000U-35"
      }
    ],
    "value": 600,
    "coupon": ""
  }

But on firebase I can see only currency, value and coupon params. The param items never appears. The same happens on the other events.

I've searched for similar issues but I found only this one that seems almost the same but with less details.

I found this comment on a PR too, but, it doesn't help me in case of sending more than one Item as a param (that happens on Begin Checkout event for exemple).

Finishing, my main problem is that I cannot see some of the parameters that I'm sending to firebase, I'm not sure if it is a DOCs or code problem. So, please, let me know what should be the proper way to use those parameters and why I'm not able to see them.


Project Files

Javascript

Click To Expand

#### `package.json`: ```json { "name": "ProjectName", "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 ." }, "dependencies": { "@ptomasroos/react-native-multi-slider": "2.2.2", "@react-native-community/async-storage": "1.8.0", "@react-native-community/cameraroll": "1.7.2", "@react-native-community/clipboard": "1.2.3", "@react-native-community/masked-view": "0.1.7", "@react-native-community/picker": "1.6.5", "@react-native-firebase/analytics": "7.3.1", "@react-native-firebase/app": "8.2.0", "@react-navigation/bottom-tabs": "5.2.4", "@react-navigation/native": "5.1.3", "@react-navigation/stack": "5.2.6", "axios": "0.19.2", "dayjs": "1.8.28", "formik": "2.1.4", "gerador-validador-cpf": "4.0.1", "intl": "1.2.5", "prop-types": "15.7.2", "react": "16.13.1", "react-native": "0.63.0", "react-native-camera": "3.30.0", "react-native-code-push": "6.3.0", "react-native-device-info": "5.6.2", "react-native-fbsdk": "2.0.0", "react-native-gesture-handler": "1.6.1", "react-native-image-resizer": "1.2.3", "react-native-image-zoom-viewer": "3.0.1", "react-native-linear-gradient": "2.5.6", "react-native-reanimated": "1.7.1", "react-native-safe-area-context": "0.7.3", "react-native-scalable-image": "1.0.0", "react-native-screens": "2.4.0", "react-native-vector-icons": "6.6.0", "react-native-zz-components": "1.0.0", "react-redux": "7.2.0", "redux": "4.0.5", "redux-persist": "6.0.0", "redux-saga": "1.1.3", "rn-fetch-blob": "0.12.0" }, "devDependencies": { "@babel/core": "7.8.4", "@babel/runtime": "7.8.4", "@commitlint/cli": "8.3.5", "@commitlint/config-conventional": "8.3.4", "@react-native-community/eslint-config": "1.1.0", "babel-eslint": "10.0.3", "babel-jest": "25.1.0", "babel-plugin-module-resolver": "4.0.0", "eslint": "6.8.0", "eslint-config-airbnb": "18.0.1", "eslint-config-prettier": "6.10.0", "eslint-import-resolver-babel-module": "5.1.2", "eslint-plugin-import": "2.20.1", "eslint-plugin-import-helpers": "1.0.2", "eslint-plugin-jsx-a11y": "6.2.3", "eslint-plugin-prettier": "3.1.2", "eslint-plugin-react": "7.18.3", "eslint-plugin-react-hooks": "2.4.0", "husky": "4.2.3", "jest": "25.1.0", "metro-react-native-babel-preset": "0.59.0", "prettier": "1.19.1", "react-test-renderer": "16.13.1", "reactotron-react-native": "4.0.3", "reactotron-redux": "3.1.2", "reactotron-redux-saga": "4.2.3" }, "jest": { "preset": "react-native" }, "husky": { "hooks": { "commit-msg": "commitlint -E HUSKY_GIT_PARAMS" } } } ``` #### `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 require_relative '../node_modules/react-native/scripts/react_native_pods' require_relative '../node_modules/@react-native-community/cli-platform-ios/native_modules' platform :ios, '10.0' target 'ProjectName' do config = use_native_modules! use_react_native!(:path => config["reactNativePath"]) target 'ProjectNameTests' do inherit! :complete # Pods for testing end use_native_modules! # Enables Flipper. # # Note that if you have use_frameworks! enabled, Flipper will not work and # you should disable these next few lines. use_flipper! post_install do |installer| flipper_post_install(installer) end end ``` #### `AppDelegate.m`: ```objc #import "AppDelegate.h" #import #import #import #import #import #import #import #import #if DEBUG #ifdef FB_SONARKIT_ENABLED #import #import #import #import #import #import static void InitializeFlipper(UIApplication *application) { FlipperClient *client = [FlipperClient sharedClient]; SKDescriptorMapper *layoutDescriptorMapper = [[SKDescriptorMapper alloc] initWithDefaults]; [client addPlugin:[[FlipperKitLayoutPlugin alloc] initWithRootNode:application withDescriptorMapper:layoutDescriptorMapper]]; [client addPlugin:[[FKUserDefaultsPlugin alloc] initWithSuiteName:nil]]; [client addPlugin:[FlipperKitReactPlugin new]]; [client addPlugin:[[FlipperKitNetworkPlugin alloc] initWithNetworkAdapter:[SKIOSNetworkAdapter new]]]; [client start]; } #endif #endif @implementation AppDelegate - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions { #if DEBUG #ifdef FB_SONARKIT_ENABLED InitializeFlipper(application); #endif #endif [FIRApp configure]; RCTBridge *bridge = [[RCTBridge alloc] initWithDelegate:self launchOptions:launchOptions]; RCTRootView *rootView = [[RCTRootView alloc] initWithBridge:bridge moduleName:@"ProjectName" initialProperties:nil]; rootView.backgroundColor = [[UIColor alloc] initWithRed:1.0f green:1.0f blue:1.0f alpha:1]; self.window = [[UIWindow alloc] initWithFrame:[UIScreen mainScreen].bounds]; UIViewController *rootViewController = [UIViewController new]; rootViewController.view = rootView; self.window.rootViewController = rootViewController; [self.window makeKeyAndVisible]; return YES; } - (BOOL)application:(UIApplication *)app openURL:(NSURL *)url options:(NSDictionary *)options { if ([[FBSDKApplicationDelegate sharedInstance] application:app openURL:url options:options]) { return YES; } if ([RCTLinkingManager application:app openURL:url options:options]) { return YES; } return NO; } - (NSURL *)sourceURLForBridge:(RCTBridge *)bridge { #if DEBUG return [[RCTBundleURLProvider sharedSettings] jsBundleURLForBundleRoot:@"index" fallbackResource:nil]; #else return [CodePush bundleURL]; #endif } @end ```


Android

Click To Expand

#### Have you converted to AndroidX? - [x] my application is an AndroidX application? - [x] 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 = "29.0.2" minSdkVersion = 16 compileSdkVersion = 29 targetSdkVersion = 29 } repositories { google() jcenter() } dependencies { classpath("com.android.tools.build:gradle:3.5.3") classpath('com.google.gms:google-services:4.3.3') // NOTE: Do not place your application dependencies here; they belong // in the individual module build.gradle files } } allprojects { repositories { mavenLocal() maven { // All of React Native (JS, Obj-C sources, Android binaries) is installed from npm url("$rootDir/../node_modules/react-native/android") } maven { // Android JSC is installed from npm url("$rootDir/../node_modules/jsc-android/dist") } google() jcenter() maven { url 'https://www.jitpack.io' } } } ``` #### `android/app/build.gradle`: ```groovy apply plugin: "com.android.application" apply plugin: 'com.google.gms.google-services' import com.android.build.OutputFile /** * The react.gradle file registers a task for each build variant (e.g. bundleDebugJsAndAssets * and bundleReleaseJsAndAssets). * These basically call `react-native bundle` with the correct arguments during the Android build * cycle. By default, bundleDebugJsAndAssets is skipped, as in debug/dev mode we prefer to load the * bundle directly from the development server. Below you can see all the possible configurations * and their defaults. If you decide to add a configuration block, make sure to add it before the * `apply from: "../../node_modules/react-native/react.gradle"` line. * * project.ext.react = [ * // the name of the generated asset file containing your JS bundle * bundleAssetName: "index.android.bundle", * * // the entry file for bundle generation. If none specified and * // "index.android.js" exists, it will be used. Otherwise "index.js" is * // default. Can be overridden with ENTRY_FILE environment variable. * entryFile: "index.android.js", * * // https://reactnative.dev/docs/performance#enable-the-ram-format * bundleCommand: "ram-bundle", * * // whether to bundle JS and assets in debug mode * bundleInDebug: false, * * // whether to bundle JS and assets in release mode * bundleInRelease: true, * * // whether to bundle JS and assets in another build variant (if configured). * // See http://tools.android.com/tech-docs/new-build-system/user-guide#TOC-Build-Variants * // The configuration property can be in the following formats * // 'bundleIn${productFlavor}${buildType}' * // 'bundleIn${buildType}' * // bundleInFreeDebug: true, * // bundleInPaidRelease: true, * // bundleInBeta: true, * * // whether to disable dev mode in custom build variants (by default only disabled in release) * // for example: to disable dev mode in the staging build type (if configured) * devDisabledInStaging: true, * // The configuration property can be in the following formats * // 'devDisabledIn${productFlavor}${buildType}' * // 'devDisabledIn${buildType}' * * // the root of your project, i.e. where "package.json" lives * root: "../../", * * // where to put the JS bundle asset in debug mode * jsBundleDirDebug: "$buildDir/intermediates/assets/debug", * * // where to put the JS bundle asset in release mode * jsBundleDirRelease: "$buildDir/intermediates/assets/release", * * // where to put drawable resources / React Native assets, e.g. the ones you use via * // require('./image.png')), in debug mode * resourcesDirDebug: "$buildDir/intermediates/res/merged/debug", * * // where to put drawable resources / React Native assets, e.g. the ones you use via * // require('./image.png')), in release mode * resourcesDirRelease: "$buildDir/intermediates/res/merged/release", * * // by default the gradle tasks are skipped if none of the JS files or assets change; this means * // that we don't look at files in android/ or ios/ to determine whether the tasks are up to * // date; if you have any other folders that you want to ignore for performance reasons (gradle * // indexes the entire tree), add them here. Alternatively, if you have JS files in android/ * // for example, you might want to remove it from here. * inputExcludes: ["android/**", "ios/**"], * * // override which node gets called and with what additional arguments * nodeExecutableAndArgs: ["node"], * * // supply additional arguments to the packager * extraPackagerArgs: [] * ] */ project.ext.react = [ enableHermes: false, // clean and rebuild if changing ] apply from: "../../node_modules/react-native/react.gradle" apply from: "../../node_modules/react-native-code-push/android/codepush.gradle" /** * Set this to true to create two separate APKs instead of one: * - An APK that only works on ARM devices * - An APK that only works on x86 devices * The advantage is the size of the APK is reduced by about 4MB. * Upload all the APKs to the Play Store and people will download * the correct one based on the CPU architecture of their device. */ def enableSeparateBuildPerCPUArchitecture = false /** * Run Proguard to shrink the Java bytecode in release builds. */ def enableProguardInReleaseBuilds = false /** * The preferred build flavor of JavaScriptCore. * * 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:+' /** * Whether to enable the Hermes VM. * * This should be set on project.ext.react and mirrored here. If it is not set * on project.ext.react, JavaScript will not be compiled to Hermes Bytecode * and the benefits of using Hermes will therefore be sharply reduced. */ def enableHermes = project.ext.react.get("enableHermes", false); android { compileSdkVersion rootProject.ext.compileSdkVersion compileOptions { sourceCompatibility JavaVersion.VERSION_1_8 targetCompatibility JavaVersion.VERSION_1_8 } defaultConfig { applicationId "projectid" minSdkVersion rootProject.ext.minSdkVersion targetSdkVersion rootProject.ext.targetSdkVersion versionCode 8 versionName "0.9.1-integ01" missingDimensionStrategy 'react-native-camera', 'general' multiDexEnabled true } splits { abi { reset() enable enableSeparateBuildPerCPUArchitecture universalApk false // If true, also generate a universal APK include "armeabi-v7a", "x86", "arm64-v8a", "x86_64" } } signingConfigs { debug { storeFile file('debug.keystore') storePassword 'android' keyAlias 'androiddebugkey' keyPassword 'android' } release { if (project.hasProperty('MYAPP_RELEASE_STORE_FILE')) { storeFile file(MYAPP_RELEASE_STORE_FILE) storePassword MYAPP_RELEASE_STORE_PASSWORD keyAlias MYAPP_RELEASE_KEY_ALIAS keyPassword MYAPP_RELEASE_KEY_PASSWORD } } } 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 def versionCodes = ["armeabi-v7a": 1, "x86": 2, "arm64-v8a": 3, "x86_64": 4] def abi = output.getFilter(OutputFile.ABI) if (abi != null) { // null for the universal-debug, universal-release variants output.versionCodeOverride = versionCodes.get(abi) * 1048576 + defaultConfig.versionCode } } } } dependencies { implementation fileTree(dir: "libs", include: ["*.jar"]) implementation "com.facebook.react:react-native:+" implementation "androidx.swiperefreshlayout:swiperefreshlayout:1.0.0" implementation 'com.google.firebase:firebase-analytics:17.2.2' implementation 'androidx.appcompat:appcompat:1.1.0-rc01' implementation 'androidx.swiperefreshlayout:swiperefreshlayout:1.1.0-alpha02' implementation 'com.facebook.android:facebook-login:[5,6)' implementation project(':react-native-vector-icons') debugImplementation("com.facebook.flipper:flipper:${FLIPPER_VERSION}") { exclude group:'com.facebook.fbjni' } debugImplementation("com.facebook.flipper:flipper-network-plugin:${FLIPPER_VERSION}") { exclude group:'com.facebook.flipper' } debugImplementation("com.facebook.flipper:flipper-fresco-plugin:${FLIPPER_VERSION}") { exclude group:'com.facebook.flipper' } if (enableHermes) { def hermesPath = "../../node_modules/hermes-engine/android/"; debugImplementation files(hermesPath + "hermes-debug.aar") releaseImplementation files(hermesPath + "hermes-release.aar") } else { implementation jscFlavor } } // Run this once to be able to run the application with BUCK // puts all compile dependencies into folder libs for BUCK to use task copyDownloadableDepsToLibs(type: Copy) { from configurations.compile into 'libs' } apply from: file("../../node_modules/@react-native-community/cli-platform-android/native_modules.gradle"); applyNativeModulesAppBuildGradle(project) ``` #### `android/settings.gradle`: ```groovy rootProject.name = 'ProjectName' include ':react-native-vector-icons' project(':react-native-vector-icons').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-vector-icons/android') apply from: file("../node_modules/@react-native-community/cli-platform-android/native_modules.gradle"); applyNativeModulesSettingsGradle(settings) include ':app', ':react-native-code-push' project(':react-native-code-push').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-code-push/android/app') ``` #### `MainApplication.java`: ```java package projectpackage; import android.app.Application; import android.content.Context; import com.facebook.react.PackageList; import com.facebook.react.ReactApplication; import com.facebook.react.ReactInstanceManager; import com.facebook.react.ReactNativeHost; import com.facebook.react.ReactPackage; import com.facebook.soloader.SoLoader; import projectname.BuildConfig; import com.microsoft.codepush.react.CodePush; import java.lang.reflect.InvocationTargetException; import java.util.List; public class MainApplication extends Application implements ReactApplication { private final ReactNativeHost mReactNativeHost = new ReactNativeHost(this) { @Override public boolean getUseDeveloperSupport() { return BuildConfig.DEBUG; } @Override protected List getPackages() { @SuppressWarnings("UnnecessaryLocalVariable") List packages = new PackageList(this).getPackages(); // Packages that cannot be autolinked yet can be added manually here, for example: // packages.add(new MyReactNativePackage()); return packages; } @Override protected String getJSMainModuleName() { return "index"; } @Override protected String getJSBundleFile() { return CodePush.getJSBundleFile(); } }; @Override public ReactNativeHost getReactNativeHost() { return mReactNativeHost; } @Override public void onCreate() { super.onCreate(); SoLoader.init(this, /* native exopackage */ false); initializeFlipper(this, getReactNativeHost().getReactInstanceManager()); } /** * Loads Flipper in React Native templates. Call this in the onCreate method with something like * initializeFlipper(this, getReactNativeHost().getReactInstanceManager()); * * @param context * @param reactInstanceManager */ private static void initializeFlipper(Context context, ReactInstanceManager reactInstanceManager) { if (BuildConfig.DEBUG) { try { /* We use reflection here to pick up the class that initializes Flipper, since Flipper library is not available in release mode */ Class aClass = Class.forName("pejectname.flipper"); aClass.getMethod("initializeFlipper", Context.class, ReactInstanceManager.class) .invoke(null, context, reactInstanceManager); } catch (ClassNotFoundException e) { e.printStackTrace(); } catch (NoSuchMethodException e) { e.printStackTrace(); } catch (IllegalAccessException e) { e.printStackTrace(); } catch (InvocationTargetException e) { e.printStackTrace(); } } } } ``` #### `AndroidManifest.xml`: ```xml ```


Environment

Click To Expand

**`react-native info` output:** ``` react-native info info Fetching system and libraries information... System: OS: macOS Mojave 10.14.6 CPU: (12) x64 Intel(R) Core(TM) i7-9750H CPU @ 2.60GHz Memory: 20.29 MB / 16.00 GB Shell: 5.3 - /bin/zsh Binaries: Node: 12.14.1 - ~/.nvm/versions/node/v12.14.1/bin/node Yarn: 1.21.1 - /usr/local/bin/yarn npm: 6.13.4 - ~/.nvm/versions/node/v12.14.1/bin/npm Watchman: 4.9.0 - /usr/local/bin/watchman Managers: CocoaPods: 1.8.4 - /usr/local/bin/pod SDKs: iOS SDK: Platforms: iOS 13.2, DriverKit 19.0, macOS 10.15, tvOS 13.2, watchOS 6.1 Android SDK: API Levels: 28, 29 Build Tools: 28.0.3, 29.0.2 System Images: android-28 | Google Play Intel x86 Atom, android-29 | Google APIs Intel x86 Atom, android-R | Google Play Intel x86 Atom Android NDK: Not Found IDEs: Android Studio: 3.5 AI-191.8026.42.35.6010548 Xcode: 11.3.1/11C504 - /usr/bin/xcodebuild Languages: Java: 1.8.0_232 - /usr/bin/javac Python: 2.7.10 - /usr/bin/python npmPackages: @react-native-community/cli: Not Found react: 16.13.1 => 16.13.1 react-native: 0.63.0 => 0.63.0 npmGlobalPackages: *react-native*: Not Found ``` - **Platform that you're experiencing the issue on**: - [ ] iOS - [ ] Android - [ ] **iOS** but have not tested behavior on Android - [ ] **Android** but have not tested behavior on iOS - [x] Both - **`react-native-firebase` version you're using that has this issue:** "@react-native-firebase/analytics": "7.3.1", "@react-native-firebase/app": "8.2.0", - **`Firebase` module(s) you're using that has the issue:** - `e.g. Instance ID` - **Are you using `TypeScript`?** - N


ghost commented 4 years ago

@Ehesp Could you please take a look on this? I'm struggling around for days with no results.

ghost commented 4 years ago

@dackers86 and @russellwheatley, sorry, but, have you guys any feedback about this issue?

Ehesp commented 4 years ago

Nope, will most likely be next week once we review who's assigned to what.

ghost commented 4 years ago

Any good news on this? My app is going to production in some weeks and it would be nice to have a response about it.

mikehardy commented 4 years ago

There has been some internal discussion (if I saw correctly) but unfortunately no resolution yet. My take on that is that it seemed easy and yet has defied explanation thus far

russellwheatley commented 4 years ago

Hey @emilioheinz, just to give you an update. I've tried to send analytics events with items in debug mode on android, ios & web. They never seem to appear in the firebase console debug view. I have seen hints of certain properties appearing in the charts in the analytics "events" tab, but none of the values I have sent are available to view.

I have also sent items in the non-debug view for android & ios. This takes time, as events can take up to 24 hours to appear in the console. Unfortunately, there is still no sign of items available in the console.

On Thursday, I tried sending items via the web sdk, and the events didn't register at all for whatever reason, so I've tried sending items from scratch today.

The documentation isn't clear about where the items ought to appear. If you click on the BigQuery view from your "events" tab in the Analytics portion of the firebase console, you can see columns with the item properties. A part of me wonders if items are accessible from the firebase console. Or if there has to be a critical mass of users before certain values are visible? I thought I read something to that effect a while back which I sadly can't find now.

I'm curious about your experience. Have you ever seen "items" sent via web, ios or android appear in your firebase console? Or if you could point me to some evidence I'd be very grateful!

mikehardy commented 4 years ago

very interesting - if this is easily reproducible via the https://github.com/firebase/firebase-js-sdk/ then you could make a quick repro using plain javascript and take this up with official support channels and get a definitive answer @emilioheinz

ghost commented 4 years ago

Hello @russellwheatley. I've never seen those parameters in console, it is the first time that I'm implementing Firebase for React Native with the new Docs/SDK version. In older versions the way that we used to send data about the items was different and seemed to work well. Just to confirm... there is a bug but we don't know exactly was is happening or how to fix it, right? If there is something that I can do to help you guys, tell me, I'll take a look asap.

@mikehardy I'm not as experienced in Web as I'm in mobile world, but I'll take a look and try to get in contact if it is reproducible. Thank you.

mikehardy commented 4 years ago

If you are more experienced with mobile you could do the same (try to reproduce using only native APIs) with https://github.com/firebase/firebase-ios-sdk or https://github.com/firebase/firebase-android-sdk/ direct APIs and a minimal reproduction app you can post on github to share with Google in an issue directly on those repositories

Which is to say: the way to hurry this along I think is to give Google a reproduction using their APIs directly (so they will accept the issue) and ask the question upstream - I'm not sure we'll be able to make any more progress here

ghost commented 4 years ago

Ok, thank you, I'll take a look on this!

boliveira commented 4 years ago

Hi guys,

Just wanted to add that the price field should be allowed in the Item struct as well (can be an optional) as several events accept it in Firebase and today that is not possible to add.

ghost commented 4 years ago

It is confirmed, the Firebase Javascript SDK is not showing the items param too.

I'm firing the event like that:

analytics.logEvent("add_to_cart", {
      currency: "BRL",
      value: 200,
      items: [
        {
          brand: "ITEM_BRAND",
          category: "IMTEM_CATEGORY",
          name: "ITEM_NAME",
          price: 300,
        },
      ],
    });

And on the debug mode nothing about items appears. image

@mikehardy In that case do you think that I should open an issue on https://github.com/firebase/firebase-js-sdk/ ???

I think I will wait some days until I can see the event and the parameters on the rest of the dashboard and not only on debug mode. Then make sure that the "items" parameter is really not visible for us.

If you guys want to take a look on the code that I wrote to test it, you can go to this repository and just run npm start on the root of the project.

mikehardy commented 4 years ago

Definitely open an issue upstream now that you have a reproduction, it should receive quick attention and either decisive information explaining, or some idea of the fix. Good work getting the reproduction test case going

ghost commented 4 years ago

I think you can close this issue, I've filed a ticket to Firebase support and they answered this:

image

Thank you for the help πŸ˜‰

mikehardy commented 4 years ago

Haha, okay then. What can you do? :shrug: - thanks for following up though, good to know the state of things at minimum

andersonaddo commented 4 years ago

Interesting. I'll put this in the FAQs

russellwheatley commented 4 years ago

Just to add a bit more context, I tried adding items a few months ago and I couldn't get them to appear in the console. I just assumed it was something I was doing wrong / it wasn't possible.

ghost commented 4 years ago

Something that I can't understand is how does this bug is so much time in Firebase's production backend.

boliveira commented 4 years ago

Also, the Item struct currently does not have the price property defined, which will make calls to log* events that contain prices in each item, to throw an exception as it will not pass the struct validation. This should be corrected in structs.js file.

const Item = struct({
  item_brand: 'string?',
  item_id: 'string?',
  item_name: 'string?',
  item_category: 'string?',
  item_category2: 'string?',
  item_category3: 'string?',
  item_category4: 'string?',
  item_category5: 'string?',
  item_list_id: 'string?',
  item_list_name: 'string?',
  item_location_id: 'string?',
  item_variant: 'string?',
});
russellwheatley commented 4 years ago

Hey @boliveira, thanks for letting us know! We'll get round to this at some point. If you want to raise a PR in the mean time, we'd be happy to accept πŸ˜„

ghost commented 3 years ago

It seem that something has changes, I have not tested all scenarios but there is some improvement.

image

GuerreiroLeonardo commented 3 years ago

I'm having the same issue. Items not showing on debugView

image image

ekynoxe commented 3 years ago

It seem that something has changes, I have not tested all scenarios but there is some improvement.

Hi @emilioheinz, did you have to configure anything special to see items in a different tab in the debug view? In my firebase console I still see "items" as a "Parameter", and it shows [object Object].

Screenshot 2021-05-20 at 09 08 01
ghost commented 3 years ago

@ekynoxe Nope, just make sure that you are in one of the latest versions, it should work.

ekynoxe commented 3 years ago

@emilioheinz Sadly, I think in my case it might be inside expo. I'm using expo-firebase-analytics as part of an expo react native app, and it could potentially be in there. More digging to do.

mikehardy commented 3 years ago

Indeed, nothing about expo is related to react-native-firebase. Best course of action is to take that to the expo repo for support.

balwinderSingh1989 commented 3 years ago

any updates on this.??..

Screen Shot 2021-06-16 at 6 52 01 PM

m getting ga_error_value(_ev)=items always and at debugview it says[

Screen Shot 2021-06-16 at 6 51 54 PM

](url)

mikehardy commented 3 years ago

There are almost never updates on closed issues, none are planned here. I believe this is an upstream issue so you might chase down the underlying SDK repo issues list or ask on stackoverflow (firebase folks offer support there)

BarathA-08 commented 2 years ago

Dear All, We are using react-native firebase API version 12.9.3 From our App, we are calling logAddToCart function which will intern fire add_to_cart event with the payload passed (currency, value and items). But we see this event triggers as addToCart instead of add_to_cart because of which the event throws ga_error=21 and the items param is not receiving at firebase dashboard.

Firebase_Debug_View_ScreenShot LogCat_Screenshot

Below is the sample payload.

{ currency: "INR", value: 399, items: [ { item_id: "A-32786-0", item_name: "5 Leg piece + 2 Dips", item_category: "Bucket Meals", item_list_name: "Bucket Meals", quantity: 1 } ] } Your suggestion/help is greatly appreciated. Regards, Barath A

mikehardy commented 2 years ago

Looks suspiciously like a custom event you have added yourself?

https://github.com/invertase/react-native-firebase/blob/bb1bf4c8563cf48b5280138a59e12ec0cb24cd47/packages/analytics/lib/index.js#L243

https://github.com/invertase/react-native-firebase/blob/bb1bf4c8563cf48b5280138a59e12ec0cb24cd47/packages/analytics/lib/index.js#L104

https://github.com/invertase/react-native-firebase/blob/bb1bf4c8563cf48b5280138a59e12ec0cb24cd47/packages/analytics/android/src/main/java/io/invertase/firebase/analytics/UniversalFirebaseAnalyticsModule.java#L38

You can see we're just logging add_to_cart

Does that match your analysis of the code when you traced it through? What's your app doing. I'd triple-check your app code.

BarathA-08 commented 2 years ago

Hi Mikehardy, Thanks for your response.

We downgraded the react-native firebase API to 10.4.1 The event correctly triggers as add_to_cart for iOS. But for Android we see same error still. Below is what I am trying.

import { firebase } from '@react-native-firebase/analytics'; firebase.analytics().logAddToCart({ currency: 'INR', value: 99, items: [ { item_id: '100', item_name: 'Chicken Burger', item_category: 'Burger', item_list_name: 'Burger List', quantity: 1, }, ], }); But, I am getting below error. image image

Can you please suggest?

Regards, Barath A

mikehardy commented 2 years ago

I can suggest focusing on current versions to correctly identify the problem, no attempt to triage will be made on old versions, sorry.

I asked this:

Does that match your analysis of the code when you traced it through?

Instrument our code in node_modules and report findings. I think our module is doing things correctly. You may try a native reproduction using the parameters your instrumentation indicates we are sending to the native code: https://github.com/firebase/quickstart-android/tree/master/analytics

BarathA-08 commented 2 years ago

Mike,

Upgraded to version 12.9.3 and 13.0.1. On tracing, In both we see the logAddToCart event is properly received and converted to 'add_to_cart' until react layer (kfc-rn/node_modules/@react-native-firebase/analytics/lib/index.js) After native layer (iOS, Andriod) its not properly parsed/converted. From the native layer its triggered as addToCart. image image

mikehardy commented 2 years ago

Instrument our code in node_modules and report findings. I think our module is doing things correctly.

Instrument the java methods, logging parameters sent to underlying firebase-android-sdk and return received, not just the javascript

I suspect it's fine there, but am open to a surprise.

If we are sending the correct event per firebase-android-sdk docs (reference APIs available on google's firebase docs site) then you'll need the native repro as mentioned and open a firebase-android-sdk issue

I continue to assert this module is calling native SDKs correctly and this is not actionable here.

mikehardy commented 2 years ago

Oh, and this:

Upgraded to version 12.9.3 and 13.0.1

scares me, I hope you mean you tried each version as a set, but are consistently on 13.0.1 now - because mixing and matching is not going to work and someone else just resolved a remote config issue by making their versions consistent

https://invertase.io/blog/react-native-firebase-versioning

BarathA-08 commented 2 years ago

Mike,

we stick to version 13.0.1 now. we see for both iOS and Android, function logAddToCart triggers addToCart only. is this a known issue? Was this already reported by anyone else? if you are aware of?

mikehardy commented 2 years ago

No one has reported this ever

BarathA-08 commented 2 years ago

Thanks Mike, we will triage further from our end and let you know if we fix it.

BenMcLoughlin commented 2 years ago

I was using Expo and had this issue and finally figured out what the problem was. Google sets the schema of the item object to have key values with 'item_' in the name like so: item_id: "SKU12345", but in expo they require that you remove the 'item' prefix in the name for it to work. So if you send 'item_id: "SKU_12345"' it sets it as (not set) but 'id: "SKU_12345"' will work. See their example here: https://docs.expo.dev/versions/latest/sdk/firebase-analytics/

dominicdev commented 2 years ago

Hi I'm having the same problem also a week now, I can see the items from the realtime, but I cant find a way how to show it in dashboard or even in event page

abdelmajidrajad commented 2 years ago

this happens to me on iOS too, did someone found a workaround ? @ekynoxe @russellwheatley

Gautam37510 commented 1 year ago

Only send parameters from the link below and remove any other parameters, worked for me😊

https://rnfirebase.io/reference/analytics/item

QuangBinhDinh commented 9 months ago

Hello I am experiencing the same issue. When I turn on Debug View , I can see the add_to_cart event along with its parameter and items. However in the Realtime Analytics section, while checking the event tabs in last 30 minutes I cannot see the items of add_to_cart event.

Untitled

[

Untitled

](url)

This is the package information I use: "@react-native-firebase/analytics": "^18.5.0", "@react-native-firebase/app": "^18.5.0",

@mikehardy Do you think Firebase Console lack of this information? If not please tell me where can I find it in real time. Thanks.