add tracking for code generators

Summary: Tracks a Google Analytics event once the code generator is opened.

Reviewed By: emilsjolander

Differential Revision: D7097182

fbshipit-source-id: 637a96db981f5e90c9f7ce155ba8669b8dac98fa
This commit is contained in:
Daniel Büchele
2018-02-27 07:01:44 -08:00
committed by Facebook Github Bot
parent 419e29c5a6
commit d0bee487e0

View File

@@ -66,7 +66,19 @@ export default class CodeGenerators extends Component<Props, State> {
copied: false, copied: false,
}; };
onClick = ({key}: {key: string}) => this.setState({showModal: key}); _ref: ?HTMLTextAreaElement;
onClick = ({key}: {key: string}) => {
this.setState({showModal: key});
if (window.ga) {
window.ga('send', {
hitType: 'event',
eventCategory: 'CodeGenerators',
eventAction: 'show',
eventLabel: key,
});
}
};
onCopy = () => { onCopy = () => {
if (this._ref) { if (this._ref) {