Skip to content

Commit

Permalink
refactor: npm for analytics
Browse files Browse the repository at this point in the history
  • Loading branch information
yongenaelf committed Oct 15, 2024
1 parent 2143acc commit ae64fbc
Show file tree
Hide file tree
Showing 5 changed files with 139 additions and 175 deletions.
120 changes: 120 additions & 0 deletions package-lock.json

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

4 changes: 4 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@
"typecheck": "tsc"
},
"dependencies": {
"@amplitude/analytics-browser": "^2.11.7",
"@amplitude/plugin-ga-events-forwarder-browser": "^0.3.4",
"@docusaurus/core": "3.4.0",
"@docusaurus/preset-classic": "3.4.0",
"@mdx-js/react": "^3.0.0",
Expand All @@ -27,6 +29,8 @@
"prism-react-renderer": "^2.3.0",
"react": "^18.0.0",
"react-dom": "^18.0.0",
"react-ga4": "^2.1.0",
"react-gtm-module": "^2.0.11",
"rehype-katex": "^7.0.0",
"remark-math": "^6.0.0"
},
Expand Down
1 change: 1 addition & 0 deletions src/theme/Root.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import BrowserOnly from "@docusaurus/BrowserOnly";
import React from "react";
import ChatComponent from "./ChatPAAL";
import "./analytics";

// Default implementation, that you can customize
export default function Root({ children }) {
Expand Down
14 changes: 14 additions & 0 deletions src/theme/analytics.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
import * as amplitude from "@amplitude/analytics-browser";
import { gaEventsForwarderPlugin } from "@amplitude/plugin-ga-events-forwarder-browser";
import ReactGA from "react-ga4";
import TagManager from "react-gtm-module";

const gaEventsForwarder = gaEventsForwarderPlugin();
amplitude.add(gaEventsForwarder);

amplitude.init("7652218546e8f6cc3d045e43a68830f6");

ReactGA.initialize("G-PFZ0BCQHMY");
TagManager.initialize({
gtmId: "GTM-NKWDMQ52",
});
175 changes: 0 additions & 175 deletions static/js/amplitude.js

This file was deleted.

0 comments on commit ae64fbc

Please sign in to comment.