React-native-firebase: "items" param is not being shown in firebase console

Created on 29 Jul 2020  路  21Comments  路  Source: invertase/react-native-firebase


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`:

{
  "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:
# N/A
### iOS
Click To Expand

#### `ios/Podfile`: - [ ] I'm not using Pods - [x] I'm using Pods and my Podfile looks like:

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`:
#import "AppDelegate.h"

#import <React/RCTBridge.h>
#import <React/RCTBundleURLProvider.h>
#import <React/RCTRootView.h>
#import <FBSDKCoreKit/FBSDKCoreKit.h>
#import <FBSDKLoginKit/FBSDKLoginKit.h>
#import <React/RCTLinkingManager.h>
#import <CodePush/CodePush.h>
#import <Firebase.h>

#if DEBUG
  #ifdef FB_SONARKIT_ENABLED
    #import <FlipperKit/FlipperClient.h>
    #import <FlipperKitLayoutPlugin/FlipperKitLayoutPlugin.h>
    #import <FlipperKitUserDefaultsPlugin/FKUserDefaultsPlugin.h>
    #import <FlipperKitNetworkPlugin/FlipperKitNetworkPlugin.h>
    #import <SKIOSNetworkPlugin/SKIOSNetworkAdapter.h>
    #import <FlipperKitReactPlugin/FlipperKitReactPlugin.h>

    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<UIApplicationOpenURLOptionsKey,id> *)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`:

// 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`:
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`:
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`:
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<ReactPackage> getPackages() {
          @SuppressWarnings("UnnecessaryLocalVariable")
          List<ReactPackage> 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`:
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
  package="project.package">

    <uses-permission android:name="android.permission.INTERNET" />
    <uses-permission android:name="android.permission.CAMERA" />
    <uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
    <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />

    <application
      android:name="project.package"
      android:label="@string/app_name"
      android:icon="@mipmap/ic_launcher"
      android:roundIcon="@mipmap/ic_launcher_round"
      android:allowBackup="false"
      android:theme="@style/AppTheme">
      <activity
        android:name="project.package"
        android:label="@string/app_name"
        android:configChanges="keyboard|keyboardHidden|orientation|screenSize|uiMode"
        android:launchMode="singleTask"
        android:windowSoftInputMode="adjustResize"
        android:screenOrientation="portrait">
        <intent-filter>
            <action android:name="android.intent.action.MAIN" />
            <category android:name="android.intent.category.LAUNCHER" />
        </intent-filter>
      </activity>
      <activity android:name="com.facebook.react.devsupport.DevSettingsActivity" />

      <meta-data android:name="com.facebook.sdk.ApplicationId" android:value="@string/facebook_app_id"/>
      <activity android:name="com.facebook.FacebookActivity" android:configChanges= "keyboard|keyboardHidden|screenLayout|screenSize|orientation" android:label="@string/app_name" />
      <activity android:name="com.facebook.CustomTabActivity" android:exported="true">
      <intent-filter>
        <action android:name="android.intent.action.VIEW" />
        <category android:name="android.intent.category.DEFAULT" />
        <category android:name="android.intent.category.BROWSABLE" />
        <data android:scheme="@string/fb_login_protocol_scheme" />
      </intent-filter>
      </activity>

    </application>

</manifest>


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




Analytics

Most helpful comment

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

image

All 21 comments

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

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

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

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.

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

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!

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

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.

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

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

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.

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.

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

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 馃槈

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

Interesting.
I'll put this in the FAQs

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.

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

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?',
});

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 馃槃

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

image

Was this page helpful?
0 / 5 - 0 ratings