Skip to content

Commit

Permalink
Analytics for target mode
Browse files Browse the repository at this point in the history
Reviewed By: antonk52

Differential Revision: D47757367

fbshipit-source-id: f6ce53a1edc3095a488097e304d3774b0702185b
  • Loading branch information
Luke De Feo authored and facebook-github-bot committed Jul 26, 2023
1 parent c1a99a8 commit b47c88f
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@ import {
FullscreenExitOutlined,
FullscreenOutlined,
} from '@ant-design/icons';
import {tracker} from '../../utils/tracker';
import {debounce} from 'lodash';

export type TargetModeState =
| {
Expand Down Expand Up @@ -79,6 +81,7 @@ export function VisualiserControls({
targetMode.targetedNodes[value],
'visualiser',
);
debouncedReportTargetAdjusted();
}}
/>
)}
Expand All @@ -91,8 +94,10 @@ export function VisualiserControls({
onClick={() => {
if (targetMode.state === 'disabled') {
setTargetMode({state: 'active'});
tracker.track('target-mode-switched', {on: true});
} else {
setTargetMode({state: 'disabled'});
tracker.track('target-mode-switched', {on: false});
}
}}
icon={
Expand Down Expand Up @@ -139,3 +144,7 @@ export function VisualiserControls({
</Layout.Right>
);
}

const debouncedReportTargetAdjusted = debounce(() => {
tracker.track('target-mode-adjusted', {});
}, 500);
4 changes: 4 additions & 0 deletions desktop/plugins/public/ui-debugger/utils/tracker.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,10 @@ type TrackerEvents = {
name: string;
tags: Tag[];
};
'target-mode-switched': {
on: boolean;
};
'target-mode-adjusted': {};
};

export interface Tracker {
Expand Down

0 comments on commit b47c88f

Please sign in to comment.