diff --git a/src/containers/app/PartDownloadViewer.js b/src/containers/app/PartDownloadViewer.js index 337e230..b221997 100644 --- a/src/containers/app/PartDownloadViewer.js +++ b/src/containers/app/PartDownloadViewer.js @@ -3,7 +3,7 @@ import PartDownload from "../../components/app/PartDownload"; import {saveImg, saveSvg} from "../../utils/downloader"; import {getDownloadCount, increaseDownloadData, recordDownloadDetail} from "../../api/db"; import {getParamDetailedValue, outerHtml} from "../../utils/util"; -import {handleDownloadEvent} from "../../utils/gaHelper"; +import {handleDownloadJpg, handleDownloadSvg} from "../../utils/gaHelper"; function saveDB(state, type, updateDownloadData) { return new Promise(resolve => { @@ -42,13 +42,13 @@ const mapStateToProps = (state, ownProps) => ({ onSvgDownload: () => { saveSvg(state.value, outerHtml(state.selectedIndex)); saveDB(state, 'svg', ownProps.updateDownloadData); - handleDownloadEvent(state.value, 0); + handleDownloadSvg(state.value); }, onJpgDownload: () => { return new Promise(resolve => { saveImg(state.value, outerHtml(state.selectedIndex), 1500, 1500).then((res) => { saveDB(state, 'jpg', ownProps.updateDownloadData).then(() => { - handleDownloadEvent(state.value, 1); + handleDownloadJpg(state.value); resolve(res) }); }); diff --git a/src/utils/gaHelper.js b/src/utils/gaHelper.js index fc41e63..36c8042 100644 --- a/src/utils/gaHelper.js +++ b/src/utils/gaHelper.js @@ -8,12 +8,19 @@ export function handleStyle(rendererName) { }); } -export function handleDownloadEvent(rendererName, value) { +export function handleDownloadSvg(rendererName) { ReactGA.event({ category: 'Style', - action: 'Download', + action: 'DownloadSvg', + label: rendererName, + }); +} + +export function handleDownloadJpg(rendererName) { + ReactGA.event({ + category: 'Style', + action: 'DownloadJpg', label: rendererName, - value: value }); }