From d0bee487e0159300d0450e14b40b7e8276e20099 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20B=C3=BCchele?= Date: Tue, 27 Feb 2018 07:01:44 -0800 Subject: [PATCH] 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 --- .../src/components/Playground/CodeGenerators.js | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/website/src/components/Playground/CodeGenerators.js b/website/src/components/Playground/CodeGenerators.js index c901dfb6..21b7f185 100644 --- a/website/src/components/Playground/CodeGenerators.js +++ b/website/src/components/Playground/CodeGenerators.js @@ -66,7 +66,19 @@ export default class CodeGenerators extends Component { 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 = () => { if (this._ref) {