Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- exports.RemovingApp =
- functions.analytics.event('buy_from_shop').onLog(event => {
- const bigQuery = bigquery({ projectId: 'littleone-150007' });
- bigQuery.query({
- query:
- Select email from
- (SELECT user.value.value.string_value as email,
- substr(cast(TIMESTAMP_ADD(TIMESTAMP_MICROS(event.timestamp_micros),
- INTERVAL 330 MINUTE) as string),1,10) AS event_date FROM
- `in_mylo_pregnancy_baby_app_ANDROID.app_events_*`,
- UNNEST(event_dim) AS event,UNNEST(user_dim.user_properties) AS user
- WHERE event.name="app_remove"
- AND user.key = "email" GROUP BY email, event_date)
- useLegacySql: false
- }).then(function (results) {
- var ref = admin.database().ref("appRemoveUsers");
- var rows = results[0]; //get all fetched table rows
- rows.forEach(function(row){ //iterate through each row
- ref.push().set({ //write to the database, under the 'DailyAppRemoveDeviceIDs' node
- Email:row['email']
- })
- })
Add Comment
Please, Sign In to add comment