Skip to content

Commit

Permalink
added mixpanel and switched back to gtag for visitor info
Browse files Browse the repository at this point in the history
  • Loading branch information
maxibenner committed Aug 6, 2021
1 parent 5a6a2dc commit 82cbf2b
Show file tree
Hide file tree
Showing 5 changed files with 51 additions and 18 deletions.
22 changes: 11 additions & 11 deletions package-lock.json

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

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,10 @@
"@testing-library/react": "^11.2.6",
"@testing-library/user-event": "^12.8.3",
"ccapture.js": "^1.1.0",
"mixpanel-browser": "^2.41.0",
"ray-tracing-renderer": "^0.10.15",
"react": "^17.0.2",
"react-dom": "^17.0.2",
"react-gtm-module": "^2.0.11",
"react-icons": "^4.2.0",
"react-scripts": "4.0.3",
"react-spring": "^9.0.0",
Expand Down
14 changes: 14 additions & 0 deletions public/index.html
Original file line number Diff line number Diff line change
@@ -1,6 +1,20 @@
<!DOCTYPE html>
<html lang="en">
<head>
<!-- Global site tag (gtag.js) - Google Analytics -->
<script
async
src="https://www.googletagmanager.com/gtag/js?id=G-HF0TVZZML1"
></script>
<script>
window.dataLayer = window.dataLayer || []
function gtag() {
dataLayer.push(arguments)
}
gtag("js", new Date())

gtag("config", "G-HF0TVZZML1")
</script>
<meta charset="utf-8" />
<link rel="icon" href="%PUBLIC_URL%/favicon.ico" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
Expand Down
8 changes: 2 additions & 6 deletions src/App.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,16 +4,12 @@ import Viewer from "./components/three/Viewer"
import logo from "./assets/images/logo.png"
import "./globalStyles.css"
import useStore from "./states/modelState"
import TagManager from "react-gtm-module"
import { Mixpanel } from './helpers/Mixpanel';

const tagManagerArgs = {
gtmId: "GTM-M4HNGJT",
}

TagManager.initialize(tagManagerArgs)

export default function App() {
const { gl } = useStore()

return (
<div style={styles.wrapper}>
<Viewer />
Expand Down
23 changes: 23 additions & 0 deletions src/helpers/Mixpanel.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
import mixpanel from 'mixpanel-browser';
mixpanel.init('77f92e65c8e7de29fa13d1f13dc3a589');

let env_check = process.env.NODE_ENV === 'production';

let actions = {
identify: (id) => {
if (env_check) mixpanel.identify(id);
},
alias: (id) => {
if (env_check) mixpanel.alias(id);
},
track: (name, props) => {
if (env_check) mixpanel.track(name, props);
},
people: {
set: (props) => {
if (env_check) mixpanel.people.set(props);
},
},
};

export let Mixpanel = actions;

0 comments on commit 82cbf2b

Please sign in to comment.