From 8a1a1119a89e2f1296f82de4055870f5900cf653 Mon Sep 17 00:00:00 2001 From: ciaochaos <1272777550@qq.com> Date: Wed, 17 Jun 2020 01:35:57 +0800 Subject: [PATCH] GA Update --- src/containers/app/InputText.js | 8 ++++++-- src/utils/gaHelper.js | 7 +++++++ 2 files changed, 13 insertions(+), 2 deletions(-) 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