Google Analytics

This commit is contained in:
CPunisher 2020-06-16 15:34:31 +08:00
parent 5c3b2680ae
commit 9bd461dfac
4 changed files with 21 additions and 4 deletions

View File

@ -11,6 +11,7 @@
"react": "^16.13.1",
"react-color": "^2.18.1",
"react-dom": "^16.13.1",
"react-ga": "^3.0.0",
"react-github-btn": "^1.2.0",
"react-redux": "^7.2.0",
"react-scripts": "3.4.1",

View File

@ -1,14 +1,23 @@
import {actionTypes} from "../constant/ActionTypes";
import ReactGA from "react-ga";
export const genQRInfo = text => ({
type: actionTypes.GENERATE_QR_INFO,
text
})
export const changeStyle = (rendererIndex, rendererType, value) => ({
type: actionTypes.CHANGE_STYLE,
rendererIndex, rendererType, value
})
export const changeStyle = (rendererIndex, rendererType, value) => {
ReactGA.event({
category: 'Style',
action: 'Switch',
value: value
});
return {
type: actionTypes.CHANGE_STYLE,
rendererIndex, rendererType, value
}
}
export const changeCorrectLevel = (correctLevel) => ({
type: actionTypes.CHANGE_CORRECT_LEVEL,

View File

@ -10,7 +10,9 @@ import PartStylesViewer from "../../containers/app/PartStylesViewer";
import {getDownloadCount, login} from "../../api/db";
import {connect} from 'react-redux';
import {loadDownloadData} from "../../actions";
import ReactGA from 'react-ga';
ReactGA.initialize('UA-165845289-1');
function App({ dispatch }) {
const updateDownloadData = useCallback((downloadData) => dispatch(loadDownloadData(downloadData)), []);

View File

@ -8703,6 +8703,11 @@ react-error-overlay@^6.0.7:
resolved "https://registry.npm.taobao.org/react-error-overlay/download/react-error-overlay-6.0.7.tgz#1dcfb459ab671d53f660a991513cb2f0a0553108"
integrity sha1-Hc+0WatnHVP2YKmRUTyy8KBVMQg=
react-ga@^3.0.0:
version "3.0.0"
resolved "https://registry.npm.taobao.org/react-ga/download/react-ga-3.0.0.tgz#4d665389cf0c489c36c5fdf97722a7e53efdfc5b"
integrity sha1-TWZTic8MSJw2xf35dyKn5T79/Fs=
react-github-btn@^1.2.0:
version "1.2.0"
resolved "https://registry.npm.taobao.org/react-github-btn/download/react-github-btn-1.2.0.tgz#464066f999a77c0eed27980260601b51cbe15614"