diff --git a/src/containers/app/InputText.js b/src/containers/app/InputText.js index 945337a..2c98a53 100644 --- a/src/containers/app/InputText.js +++ b/src/containers/app/InputText.js @@ -3,7 +3,7 @@ import {genQRInfo} from "../../actions"; import React, {useRef} from "react"; import {isPicture} from "../../utils/imageUtils"; import {decodeData} from "../../utils/qrcodeHandler"; -import {handleUpload} from "../../utils/gaHelper"; +import { handleUpload, handleInputUrl } from "../../utils/gaHelper"; const InputText = ({dispatch}) => { const textRef = useRef(); @@ -53,10 +53,14 @@ const InputText = ({dispatch}) => { className="Qr-input big-input" placeholder="https://qrbtf.com" ref={textRef} - onBlur={e => dispatch(genQRInfo(e.target.value))} + onBlur={(e) => { + handleInputUrl(); + dispatch(genQRInfo(e.target.value)) + }} onKeyPress={(e) => { if (e.key === 'Enter') { dispatch(genQRInfo(e.target.value)); + handleInputUrl(); e.target.blur(); } }} diff --git a/src/utils/gaHelper.js b/src/utils/gaHelper.js index 36c8042..95a5c28 100644 --- a/src/utils/gaHelper.js +++ b/src/utils/gaHelper.js @@ -46,3 +46,10 @@ export function handleUpload() { action: 'Click', }); } + +export function handleInputUrl() { + ReactGA.event({ + category: 'Input', + action: 'Focus', + }); +} \ No newline at end of file