Skip to content
This repository has been archived by the owner on Jul 22, 2020. It is now read-only.

Commit

Permalink
fix: init ga and mixpanel only in prod env
Browse files Browse the repository at this point in the history
  • Loading branch information
manuel-calavera authored and sunnygleason committed Jul 24, 2019
1 parent 2278bdb commit cad1e22
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 6 deletions.
16 changes: 11 additions & 5 deletions public/index.html
Original file line number Diff line number Diff line change
@@ -1,12 +1,18 @@
<!DOCTYPE html>
<html lang="en">
<head>
<script async src="https://www.googletagmanager.com/gtag/js?id=UA-112467444-2"></script>
<script>
window.dataLayer = window.dataLayer || [];
function gtag(){dataLayer.push(arguments);}
gtag('js', new Date());
gtag('config', 'UA-112467444-2');
var isProduction = "%NODE_ENV%" === 'production';
if (isProduction) {
var f = document.getElementsByTagName('script')[0];
var j = document.createElement('script');j.async=true;
j.src= 'https://www.googletagmanager.com/gtag/js?id=UA-112467444-2';
f.parentNode.insertBefore(j,f);
window.dataLayer = window.dataLayer || [];
function gtag(){dataLayer.push(arguments);}
gtag('js', new Date());
gtag('config', 'UA-112467444-2');
}
</script>
<meta charset="utf-8" />
<link rel="shortcut icon" href="%PUBLIC_URL%/favicon.ico" />
Expand Down
4 changes: 3 additions & 1 deletion src/v2/mixpanel.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
import mixpanel from 'mixpanel-browser';
mixpanel.init('a733ed40b877d30ff2a1a58b4e326cf0');

const isProduction = process.env.NODE_ENV === 'production';
if (isProduction) {
mixpanel.init('a733ed40b877d30ff2a1a58b4e326cf0');
}

export default {
identify: id => {
Expand Down

0 comments on commit cad1e22

Please sign in to comment.