0

データベース内の 'app_remove'イベントのデータを保存しようとしています。 appInfo.appInstanceIdのような標準的な情報で動作します。Firebase Cloud Functions:ユーザプロパティ値を取得

しかし、オブジェクトなのでuserPropertyの値はどのようにして取得できますか?

exports.appremoved = functions.analytics.event('app_remove').onLog(event => { 

    console.log(event.data); 
    console.log(event.data.user.Selected_Games); 

    const user = event.data.user; 
    if (user != null) { 
    if(user.userId != null){ 
     admin.database().ref('/user_events/'+user.appInfo.appInstanceId + "/" + "deviceId").set(user.userId); 
    } 

    admin.database().ref('/user_events/'+user.appInfo.appInstanceId + "/" + "app_remove").set(event.data.logTime); 
    admin.database().ref('/user_events/'+user.appInfo.appInstanceId + "/" + "app_install").set(user.firstOpenTime); 
    } 
}); 

これは私が解決策を見つけたevent.data

AnalyticsEvent { 
    params: { firebase_conversion: 1, firebase_event_origin: 'auto' }, 
    name: 'app_remove', 
    reportingDate: '20170719', 
    logTime: '2017-07-19T10:57:12.920Z', 
    user: 
    UserDimensions { 
    deviceInfo: 
     { deviceCategory: 'mobile', 
     deviceModel: 'WAS-LX1A', 
     deviceTimeZoneOffsetSeconds: 7200, 
     platformVersion: '7.0', 
     userDefaultLanguage: 'it-it' }, 
    geoInfo: 
     { city: 'Milan', 
     continent: '039', 
     country: 'Italy', 
     region: 'Lombardy' }, 
    appInfo: 
     { appId: 'com.example.example', 
     appInstanceId: '000000', 
     appPlatform: 'ANDROID', 
     appStore: 'com.android.vending', 
     appVersion: '1.12' }, 
    firstOpenTime: '2017-07-17T12:37:01.320Z', 
    userProperties: 
     { Active_Notification: [Object], 
     Referrer: [Object], 
     Selected_Games: [Object], 
     Selected_Sources: [Object], 
     Selected_Topics: [Object], 
     first_open_time: [Object], 
     user_id: [Object] }, 
    bundleInfo: ExportBundleInfo { bundleSequenceId: 10, serverTimestampOffset: 693 } } } 

答えて

2

のはconsole.logの結果です。

私がやった、そのオブジェクトのはconsole.log(event.data.user.Selected_Games)

UserPropertyValue { value: '4', setTime: '2017-06-27T01:22:25.375Z' } 

ので、値を取得する

event.data.user.userProperties.Selected_Games.value 
関連する問題