如何解决分析在本机应用程序中不起作用
我曾尝试直接使用 Firebase Analytics:
import * as firebase from 'firebase/app';
// Optionally import the services that you want to use
import "firebase/auth";
import "firebase/firestore";
import "firebase/functions";
import "firebase/storage";
// import 'firebase/analytics'; <--------- When uncommented,I get an error
// Initialize Firebase
// For Firebase JS SDK v7.20.0 and later,measurementId is optional
const firebaseConfig = {
apiKey: "//",authDomain: "//",databaseURL: "//",projectId: "//",storageBucket: "//",messagingSenderId: "//",appId: "///",measurementId: "///"
};
// Initialize Firebase
let Firebase = firebase.initializeApp(firebaseConfig)
export default Firebase
当我取消注释 import 'firebase/analytics'
时,出现以下错误:
Can't find variable: IDBIndex
查了一下,显然 Firebase Analytics 是通过 react native 做到这一点的。继续前进。
我尝试使用细分分析:
//Segment.js
import * as Segment from 'expo-analytics-segment';
Segment.initialize({ iosWriteKey: "write key" })
export default Segment;
import Segment from '../../segment'
...
componentDidMount() {
this.unsubscribe = this.firestoreRef.onSnapshot(this.getCollection);
Segment.identify({userId: Firebase.auth().currentUser.uid}) <--- nothing sent to segment
...
}
在我想跟踪事件的其他文件中:
import Segment from '../../segment'
...
sendMessage = () => {
Segment.track({event: 'message sent'}) <--- nothing sent to segment
...
}
我的细分仪表板:
显然,跟踪了 3 个事件。我不知道是哪 3 个事件,但这是 5 小时前的 - 自从记录这些事件以来,我已经测试了构建,整个应用程序都有事件跟踪器,使用我的手机,其他人的手机,我的模拟器 - 绝对没有被跟踪段。
我的堆栈:
React Native - Expo Managed Workflow SDK 40 [仅使用 iOS 版本]
用于数据库的 Firestore
细分分析
幅度数据分析
您能否看到我没有正确实施细分分析的问题,或者推荐一种更好的方法来集成分析?我按照这些文档到 T:docs
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。