Skip to content

Commit

Permalink
Add Firebase Analytics
Browse files Browse the repository at this point in the history
  • Loading branch information
ecc521 committed Jun 29, 2024
1 parent 5e380ec commit 5ab6826
Show file tree
Hide file tree
Showing 3 changed files with 31 additions and 2 deletions.
4 changes: 2 additions & 2 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@
<!-- With style-src, 'unsafe-eval' allows for things like CSSStyleSheet.insertRule(), and other JavaScript methods. -->
<!-- TODO: Consider allowing image requests over all https connections-->
<meta http-equiv="Content-Security-Policy" content="
default-src 'self' https://rivers.run https://*.rivers.run http://127.0.0.1:* https://maps.googleapis.com https://maps.gstatic.com;
connect-src 'self' https://rivers.run https://*.rivers.run http://127.0.0.1:* https://waterservices.usgs.gov https://docs.google.com https://*.googleapis.com https://maps.gstatic.com https://tile.openstreetmap.org https://mt1.google.com https://itunes.apple.com;
default-src 'self' https://rivers.run https://*.rivers.run http://127.0.0.1:* https://maps.googleapis.com https://maps.gstatic.com https://www.googletagmanager.com;
connect-src 'self' https: http:;
img-src 'self' https://rivers.run https://*.rivers.run http://127.0.0.1:* https://*.googleapis.com https://maps.gstatic.com data: blob: https://mesonet1.agron.iastate.edu;
font-src 'self' https://rivers.run https://*.rivers.run http://127.0.0.1:* data: https://fonts.googleapis.com https://fonts.gstatic.com;
style-src 'self' 'unsafe-inline'"
Expand Down
8 changes: 8 additions & 0 deletions src/allPages/allPages.js
Original file line number Diff line number Diff line change
Expand Up @@ -169,3 +169,11 @@ try {
catch (e) {
console.error(e)
}


try {
require("./analytics.js")
}
catch (e) {
console.error(e)
}
21 changes: 21 additions & 0 deletions src/allPages/analytics.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
// Import the functions you need from the SDKs you need
import { initializeApp } from "firebase/app";
import { getAnalytics } from "firebase/analytics";
// TODO: Add SDKs for Firebase products that you want to use
// https://firebase.google.com/docs/web/setup#available-libraries

// Your web app's Firebase configuration
// For Firebase JS SDK v7.20.0 and later, measurementId is optional
const firebaseConfig = {
apiKey: "AIzaSyA8hvftc7idpGNcj5I9gvOqk-DQrTrkQco",
authDomain: "rivers-run.firebaseapp.com",
projectId: "rivers-run",
storageBucket: "rivers-run.appspot.com",
messagingSenderId: "781093992108",
appId: "1:781093992108:web:a5a9db5b62f1d554c61109",
measurementId: "G-ZP92G9QBYB"
};

// Initialize Firebase
const app = initializeApp(firebaseConfig);
const analytics = getAnalytics(app);

0 comments on commit 5ab6826

Please sign in to comment.