Send tracks event when report table columns are toggled.
This commit is contained in:
parent
849d556770
commit
f7c48e6738
|
@ -41,8 +41,8 @@ class ReportTable extends Component {
|
|||
this.scrollPointRef = createRef();
|
||||
}
|
||||
|
||||
onColumnsChange( shownColumns ) {
|
||||
const { columnPrefsKey, getHeadersContent, updateCurrentUserData } = this.props;
|
||||
onColumnsChange( shownColumns, toggledColumn ) {
|
||||
const { columnPrefsKey, endpoint, getHeadersContent, updateCurrentUserData } = this.props;
|
||||
const columns = getHeadersContent().map( header => header.key );
|
||||
const hiddenColumns = columns.filter( column => ! shownColumns.includes( column ) );
|
||||
|
||||
|
@ -52,6 +52,16 @@ class ReportTable extends Component {
|
|||
};
|
||||
updateCurrentUserData( userDataFields );
|
||||
}
|
||||
|
||||
if ( toggledColumn ) {
|
||||
const eventProps = {
|
||||
report: endpoint,
|
||||
column: toggledColumn,
|
||||
status: shownColumns.includes( toggledColumn ) ? 'on' : 'off',
|
||||
};
|
||||
|
||||
recordEvent( 'analytics_table_header_toggle', eventProps );
|
||||
}
|
||||
}
|
||||
|
||||
onPageChange() {
|
||||
|
|
|
@ -128,12 +128,12 @@ class TableCard extends Component {
|
|||
}
|
||||
|
||||
const showCols = without( prevState.showCols, key );
|
||||
onColumnsChange( showCols );
|
||||
onColumnsChange( showCols, key );
|
||||
return { showCols };
|
||||
}
|
||||
|
||||
const showCols = [ ...prevState.showCols, key ];
|
||||
onColumnsChange( showCols );
|
||||
onColumnsChange( showCols, key );
|
||||
return { showCols };
|
||||
} );
|
||||
};
|
||||
|
|
Loading…
Reference in New Issue