Skip to content

Commit

Permalink
feat: use Google Analytics 4 with env variable
Browse files Browse the repository at this point in the history
  • Loading branch information
steveoh committed Sep 14, 2022
1 parent f2bc261 commit b6da991
Show file tree
Hide file tree
Showing 8 changed files with 1,759 additions and 347 deletions.
1 change: 1 addition & 0 deletions .env
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
VITE_PRINT_PROXY=
VITE_DISCOVER=
VITE_WEB_API=
VITE_FIREBASE_CONFIG=
2 changes: 2 additions & 0 deletions .env.dev
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
NODE_ENV=production
VITE_FIREBASE_CONFIG={"apiKey":"AIzaSyDWthlc4QxW6dQmGOXDynDFiDgazkgEQV8","authDomain":"ut-dts-agrc-atlas-dev-d3e52.firebaseapp.com","projectId":"ut-dts-agrc-atlas-dev","storageBucket":"ut-dts-agrc-atlas-dev.appspot.com","messagingSenderId":"516727492743","appId":"1:516727492743:web:01db116b133b9a76de6822","measurementId":"G-32QZ3T5E34"}
1 change: 1 addition & 0 deletions .env.production
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
VITE_FIREBASE_CONFIG={"apiKey":"AIzaSyCy4pwRgCLZZwwnfC2etDolNTOyJ_Oif4k","authDomain":"ut-dts-agrc-atlas-prod.firebaseapp.com","projectId":"ut-dts-agrc-atlas-prod","storageBucket":"ut-dts-agrc-atlas-prod.appspot.com","messagingSenderId":"903991188124","appId":"1:903991188124:web:87587e066dcea0d54c2b59","measurementId":"G-SEKRDV94LJ"}
1 change: 1 addition & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
"noreferrer",
"packagejson",
"padder",
"reactfire",
"sgid",
"sitla",
"sortby",
Expand Down
64 changes: 14 additions & 50 deletions index.html
Original file line number Diff line number Diff line change
@@ -1,55 +1,19 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8" />
<link rel="shortcut icon" href="favicon.ico" />
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no" />
<meta name="description" content="Atlas Utah showing off SGID data" />
<title>Atlas Utah</title>
</head>
<body>
<noscript> You need to enable JavaScript to run this app. </noscript>
<div id="root"></div>
<script type="module" src="/src/main.jsx"></script>
</body>
<!-- The core Firebase JS SDK is always required and must be listed first -->
<script src="https://www.gstatic.com/firebasejs/8.6.2/firebase-app.js"></script>

<!-- TODO: Add SDKs for Firebase products that you want to use
https://firebase.google.com/docs/web/setup#available-libraries -->
<script src="https://www.gstatic.com/firebasejs/8.6.2/firebase-analytics.js"></script>
<head>
<meta charset="utf-8" />
<link rel="shortcut icon" href="favicon.ico" />
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no" />
<meta name="description"
content="This web mapping application will show you Discover base maps, kitchen sink react components, and the esri javascript api. It is a GitHub template that you can use to create your own." />
<title>Atlas Utah : Provided by the UGRC</title>
</head>

<body>
<noscript> You need to enable JavaScript to run this app. </noscript>
<div id="root"></div>
<script type="module" src="/src/main.jsx"></script>
</body>

<script>
// Your web app's Firebase configuration
// For Firebase JS SDK v7.20.0 and later, measurementId is optional
var firebaseConfig = {
apiKey: 'AIzaSyCy4pwRgCLZZwwnfC2etDolNTOyJ_Oif4k',
authDomain: 'ut-dts-agrc-atlas-prod.firebaseapp.com',
projectId: 'ut-dts-agrc-atlas-prod',
storageBucket: 'ut-dts-agrc-atlas-prod.appspot.com',
messagingSenderId: '903991188124',
appId: '1:903991188124:web:87587e066dcea0d54c2b59',
measurementId: 'G-SEKRDV94LJ',
};
// Initialize Firebase
firebase.initializeApp(firebaseConfig);
firebase.analytics();
</script>
<script>
(function (i, s, o, g, r, a, m) {
i['GoogleAnalyticsObject'] = r;
(i[r] =
i[r] ||
function () {
(i[r].q = i[r].q || []).push(arguments);
}),
(i[r].l = 1 * new Date());
(a = s.createElement(o)), (m = s.getElementsByTagName(o)[0]);
a.async = 1;
a.src = g;
m.parentNode.insertBefore(a, m);
})(window, document, 'script', '//www.google-analytics.com/analytics.js', 'ga');
ga('create', 'UA-11849964-7', 'utah.gov');
ga('send', 'pageview');
</script>
</html>
Loading

0 comments on commit b6da991

Please sign in to comment.