我正在尝试将Amplitude集成到我的React Native项目中。我目前仍在开发应用程序并使用Expo。我想要捕获的第一个事件是用户登录时。
const events = {
USER_LOGGED_IN: 'USER_LOGGED_IN',
USER_CREATED_ACCOUNT: 'USER_CREATED_ACCOUNT',
};
let isInitialized = false;
const apiKey = 'xxxxxxxxxxxxxxxxxxxxxxxx';
const initialize = () => {
if (!Environment.isProduction || !apiKey) {
return;
}
Amplitude.initialize(apiKey);
isInitialized = true;
};
在我的渲染函数中(返回上方)我有这行代码:
render() {
Expo.Amplitude.logEvent('USER_LOGGED_IN')
return (
我没有看到任何事件发生变化。使用expo运行我的代码时是否可以看到事件?
注意 - 此代码位于我的主屏幕组件中
您需要publish your Expo app才能在Amplitude上查看事件,因为该集成仅适用于prod env。一旦您的应用程序发布,您将在Amplitude仪表板上看到一些延迟较小的事件,通常为1分钟。