diff --git a/src/components/app/PartMore.js b/src/components/app/PartMore.js index 8dab609..d0cd722 100644 --- a/src/components/app/PartMore.js +++ b/src/components/app/PartMore.js @@ -8,7 +8,7 @@ import LinkButton from "../link/LinkButton"; import ImageZoom from "../../containers/app/ImageZoom"; import LinkTrace from "../link/LinkTrace"; import {isPC} from "../../utils/navigatorUtils"; -import {handleScroll} from "../../utils/gaHelper"; +import {handleScroll, handleZoom} from "../../utils/gaHelper"; const pictures = [ 'https://7172-qrbtf-1d845d-1255694434.tcb.qcloud.la/QrbtfGallery/gallery04.jpg', @@ -103,11 +103,14 @@ const PartMore = () => { } const Gallery = ({ contents }) => { - const zoom = React.useRef(mediumZoom()); + const zoom = mediumZoom(); + const zoomRef = React.useRef(zoom); + zoom.on('open', event => {handleZoom(event.target.src)}) + return ( - contents.map((url) => ( - - + contents.map((url, index) => ( + + ) ) diff --git a/src/utils/gaHelper.js b/src/utils/gaHelper.js index 825c9b8..8716ca5 100644 --- a/src/utils/gaHelper.js +++ b/src/utils/gaHelper.js @@ -57,7 +57,15 @@ export function handleInputUrl() { export function handleScroll(label) { ReactGA.event({ category: 'ScrollContainer', - action: 'scroll', + action: 'Scroll', label: label }); } + +export function handleZoom(url) { + ReactGA.event({ + category: 'Image', + action: 'Zoom', + label: url + }); +}