Skip to content

Commit

Permalink
feat: add ga
Browse files Browse the repository at this point in the history
  • Loading branch information
zenghongtu committed Feb 21, 2022
1 parent af6beaa commit 45c921d
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 1 deletion.
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@
"prettier": "^2.5.1",
"react": "^17.0.2",
"react-dom": "^17.0.2",
"react-ga": "^3.3.0",
"react-redux": "^7.2.6",
"react-router-dom": "^6.2.1",
"redux": "^4.1.2",
Expand Down
12 changes: 12 additions & 0 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion src/renderer/src/main.tsx
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import React from 'react'
import ReactDOM from 'react-dom'
import { HashRouter } from 'react-router-dom'

import App from './App'
import './utils/ga'

ReactDOM.render(
<React.StrictMode>
Expand Down
7 changes: 7 additions & 0 deletions src/renderer/src/utils/ga.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
import ReactGA from 'react-ga'

ReactGA.initialize('UA-160700616-1', {
debug: false,
})

ReactGA.pageview(window.location.hash || '/')

0 comments on commit 45c921d

Please sign in to comment.