From c84a8f4d4043bb427a6e8d0839ba296855c47855 Mon Sep 17 00:00:00 2001 From: Moon Date: Mon, 27 Dec 2021 00:38:31 -0800 Subject: [PATCH] Add/8073 add action_click event to inbox 2.0 (https://github.com/woocommerce/woocommerce-admin/pull/8086) * Prevent firing multiple panel view event * Add inbox_action_click event when a note gets clicked * Add changelog --- .../add-8073-add-inbox2-click-event | 4 ++++ .../client/inbox-panel/index.js | 19 ++++++++++++++++--- 2 files changed, 20 insertions(+), 3 deletions(-) create mode 100644 plugins/woocommerce-admin/changelogs/add-8073-add-inbox2-click-event diff --git a/plugins/woocommerce-admin/changelogs/add-8073-add-inbox2-click-event b/plugins/woocommerce-admin/changelogs/add-8073-add-inbox2-click-event new file mode 100644 index 00000000000..c86ad1e4eef --- /dev/null +++ b/plugins/woocommerce-admin/changelogs/add-8073-add-inbox2-click-event @@ -0,0 +1,4 @@ +Significance: patch +Type: Add + +Add inbox_action_click track when a note gets clicked #8086 diff --git a/plugins/woocommerce-admin/client/inbox-panel/index.js b/plugins/woocommerce-admin/client/inbox-panel/index.js index 679a4119572..b90bfbf5e08 100644 --- a/plugins/woocommerce-admin/client/inbox-panel/index.js +++ b/plugins/woocommerce-admin/client/inbox-panel/index.js @@ -51,6 +51,8 @@ const onBodyLinkClick = ( note, innerLink ) => { } ); }; +let hasFiredPanelViewTrack = false; + const renderNotes = ( { hasNotes, isBatchUpdating, @@ -68,9 +70,12 @@ const renderNotes = ( { return renderEmptyCard(); } - recordEvent( 'inbox_panel_view', { - total: notes.length, - } ); + if ( ! hasFiredPanelViewTrack ) { + recordEvent( 'inbox_panel_view', { + total: notes.length, + } ); + hasFiredPanelViewTrack = true; + } const screen = getScreenName(); const onNoteVisible = ( note ) => { @@ -269,6 +274,14 @@ const InboxPanel = ( { showHeader = true } ) => { const onNoteActionClick = ( note, action ) => { triggerNoteAction( note.id, action.id ); + const screen = getScreenName(); + recordEvent( 'inbox_action_click', { + note_content: note.content, + note_name: note.name, + note_title: note.title, + note_type: note.type, + screen, + } ); }; if ( isError ) {