在 Firebase Analytics 中显示事件的 Expo / React Native 问题

Pru*_*dru 5 android google-analytics react-native firebase-analytics expo

我使用 expo / firebase / React Native 构建了一个电子商务应用程序,我的客户要求我在应用程序中添加分析事件,他可以在其中看到 firbase 中提供的所有数据。

我如何开始实现:Expo提供的Fallowind文档我安装了 expo-firebase-analytics模块,然后我配置了expo提供的实现,我app.json在firbase上创建项目时生成了添加文件"googleServicesFile":"./google-services.json",我从他们的文档中了解到,为了测试这些模拟器中的事件我只需要在开发过程中添加 siweb 配置。

"web": {
  "favicon": "./assets/favicon.png",
  "config": {
    "firebase": {
    "apiKey": "............",
    "authDomain":"...........",
    "projectId": "..........",
    "storageBucket": "..........",
    "messagingSenderId": ".........",
    "appId": "..............",
    "measurementId": ".................."
    }
  }
}
Run Code Online (Sandbox Code Playgroud)

下面我尝试实现 add_to_cart 事件,尝试尽可能添加我在该网站Google Analytics 4 Events上发现的数据。

addItemsToCart = async (product,qty) => {
    //Object that I created to save on redux
    const cartProd = {
        id:product.id_produs,
        product:product,
        qty:qty
    }
    //Call function that save date on redux store...
    this.props.addToCartValue(cartProd);

       //Firebae Await Event that I implemented 
        await Analytics.logEvent('add_to_cart', {
            currency:"RON",
            value:product.pret_mobile*qty,
            items:[
                {
                    item_id:cartProd.id,
                    item_name:product.nume_produs,
                    affiliation: "Google Store",
                    currency: "RON",
                    price: product.pret_mobile,
                    quantity: qty
                } 
            ]
        }).then(() => {
            console.log(' ---------------- Logging add to cart success ------------- ');
        }).catch((err)=>{
            console.log(' ---------------- Logging add to cart failed -------------- ');
        });
    }
Run Code Online (Sandbox Code Playgroud)

我现在不知道这是否是一个更好的实现,但是当我从博览会发送事件时,我遇到了问题,它们被注册并items发送。 在此输入图像描述

但是当我编译应用程序并在 google play 上对其进行调整时,当我在应用程序中创建事件时,它看起来像这样。

在此输入图像描述

在构建时,我删除了该网络配置,因为正如他们在文档中所说,这只是测试,我不知道我在实现中是否错误,考虑到这一点,我没有正确发送数据,并且value正确currency发送了问题是 items

在遇到相同的 conva 问题之前,是否有人尝试过使用 Expo 实施 Firebase Analytics,如果有,您是如何解决这些问题的。 在此输入图像描述