Google analytics tracking

Summary:
Adds tracking for:
- short URL created
- value in interactive documentation changed

Reviewed By: priteshrnandgaonkar

Differential Revision: D7123493

fbshipit-source-id: 2fc19fa6c9b5614043af508a82e898b3ccefcbaa
This commit is contained in:
Daniel Büchele
2018-03-01 06:30:51 -08:00
committed by Facebook Github Bot
parent 99026e42a9
commit 892913a69d
2 changed files with 19 additions and 1 deletions

View File

@@ -50,7 +50,17 @@ export default class DocsSidebar extends Component<Props> {
<EditValue
property={prop}
value={props.layout[prop]}
onChange={props.onChange}
onChange={(property, value) => {
if (window.ga) {
window.ga('send', {
hitType: 'event',
eventCategory: 'DocsSidebar',
eventAction: 'valueChanged',
eventLabel: prop,
});
}
props.onChange(property, value);
}}
/>,
element,
);

View File

@@ -45,6 +45,14 @@ export default class URLShortener extends Component<{}, State> {
loading: true,
},
() => {
if (window.ga) {
window.ga('send', {
hitType: 'event',
eventCategory: 'URLShortener',
eventAction: 'created'
});
}
fetch(`https://www.googleapis.com/urlshortener/v1/url?key=${API_KEY}`, {
method: 'POST',
headers: {