GA Update

This commit is contained in:
ciaochaos 2020-06-17 01:35:57 +08:00
parent a1546a5228
commit 8a1a1119a8
2 changed files with 13 additions and 2 deletions

View File

@ -3,7 +3,7 @@ import {genQRInfo} from "../../actions";
import React, {useRef} from "react"; import React, {useRef} from "react";
import {isPicture} from "../../utils/imageUtils"; import {isPicture} from "../../utils/imageUtils";
import {decodeData} from "../../utils/qrcodeHandler"; import {decodeData} from "../../utils/qrcodeHandler";
import {handleUpload} from "../../utils/gaHelper"; import { handleUpload, handleInputUrl } from "../../utils/gaHelper";
const InputText = ({dispatch}) => { const InputText = ({dispatch}) => {
const textRef = useRef(); const textRef = useRef();
@ -53,10 +53,14 @@ const InputText = ({dispatch}) => {
className="Qr-input big-input" className="Qr-input big-input"
placeholder="https://qrbtf.com" placeholder="https://qrbtf.com"
ref={textRef} ref={textRef}
onBlur={e => dispatch(genQRInfo(e.target.value))} onBlur={(e) => {
handleInputUrl();
dispatch(genQRInfo(e.target.value))
}}
onKeyPress={(e) => { onKeyPress={(e) => {
if (e.key === 'Enter') { if (e.key === 'Enter') {
dispatch(genQRInfo(e.target.value)); dispatch(genQRInfo(e.target.value));
handleInputUrl();
e.target.blur(); e.target.blur();
} }
}} }}

View File

@ -46,3 +46,10 @@ export function handleUpload() {
action: 'Click', action: 'Click',
}); });
} }
export function handleInputUrl() {
ReactGA.event({
category: 'Input',
action: 'Focus',
});
}