From 54b62c3ebf79f0aeabea2872d4eac7b3b016a926 Mon Sep 17 00:00:00 2001 From: Saahil Date: Sat, 22 Jun 2024 18:09:40 -0400 Subject: [PATCH] a little bit of analytics --- package.json | 2 ++ src/Ackee.ts | 30 ++++++++++++++++++++++++++++++ yarn.lock | 17 +++++++++++++++++ 3 files changed, 49 insertions(+) create mode 100644 src/Ackee.ts diff --git a/package.json b/package.json index 48cb31c5..b4791ebb 100644 --- a/package.json +++ b/package.json @@ -12,6 +12,7 @@ "@types/node": "^16.18.98", "@types/react": "^18.3.3", "@types/react-dom": "^18.3.0", + "ackee-tracker": "^5.1.0", "animate.css": "^4.1.1", "react": "^18.2.0", "react-animate-on-scroll": "^2.1.9", @@ -49,6 +50,7 @@ ] }, "devDependencies": { + "@types/ackee-tracker": "^5.0.4", "@types/react-animate-on-scroll": "^2.1.8", "daisyui": "^4.12.2", "tailwindcss": "^3.4.4" diff --git a/src/Ackee.ts b/src/Ackee.ts new file mode 100644 index 00000000..46b3da87 --- /dev/null +++ b/src/Ackee.ts @@ -0,0 +1,30 @@ +import * as ackeeTracker from 'ackee-tracker' +const doNotTrack = navigator.doNotTrack == "1" || localStorage.doNotTrack || sessionStorage.doNotTrack || false; +const isDev = process.env.NODE_ENV !== "production" +export enum Actions { +LCP="05296971-2faa-431b-ae01-e7d68e5d6ec4" +} +export default class Ackee { + client: ackeeTracker.AckeeInstance + domainId: string +constructor({ + server_url, id +}: { + server_url: string, + id: string +} = { + server_url: "https://ackee.saahild.com", + id: "" +}) { +this.client = ackeeTracker.create(server_url, { + detailed: doNotTrack ? false : true, + ignoreLocalhost: !isDev, + ignoreOwnVisits: false, +}) +this.domainId = id + +} +handleWebVitals(d) { + +} +} diff --git a/yarn.lock b/yarn.lock index dcc3f20b..d780192c 100644 --- a/yarn.lock +++ b/yarn.lock @@ -1901,6 +1901,11 @@ resolved "https://registry.npmjs.org/@trysound/sax/-/sax-0.2.0.tgz" integrity sha512-L7z9BgrNEcYyUYtF+HaEfiS5ebkh9jXqbszz7pC0hRBPaatV0XjSD3+eHrpqFemQfgwiFF0QPIarnIihIDn7OA== +"@types/ackee-tracker@^5.0.4": + version "5.0.4" + resolved "https://registry.yarnpkg.com/@types/ackee-tracker/-/ackee-tracker-5.0.4.tgz#14c881b746552d9b1dc0345e41d58bba48f19d13" + integrity sha512-WzQyQmV+hQEV2XptOepaQNPuV9XwAk4J39Ep7VjO5Bl6BNLugEFXj7r0jg6Qk0OQtNDgxJ2FpFxPAfi45sduog== + "@types/aria-query@^5.0.1": version "5.0.4" resolved "https://registry.npmjs.org/@types/aria-query/-/aria-query-5.0.4.tgz" @@ -2476,6 +2481,13 @@ accepts@~1.3.4, accepts@~1.3.5, accepts@~1.3.8: mime-types "~2.1.34" negotiator "0.6.3" +ackee-tracker@^5.1.0: + version "5.1.0" + resolved "https://registry.yarnpkg.com/ackee-tracker/-/ackee-tracker-5.1.0.tgz#6c41ea5357973347c7c67a26009053bcc0345def" + integrity sha512-A7iKkGyUnEXuOzxultQB7hnm4bStYCo1c38MYRRihBfqUP8AImhtZOODb00t9xrXs/BTsg06bz1MKpXeMs9sYw== + dependencies: + platform "^1.3.6" + acorn-globals@^6.0.0: version "6.0.0" resolved "https://registry.npmjs.org/acorn-globals/-/acorn-globals-6.0.0.tgz" @@ -7117,6 +7129,11 @@ pkg-up@^3.1.0: dependencies: find-up "^3.0.0" +platform@^1.3.6: + version "1.3.6" + resolved "https://registry.yarnpkg.com/platform/-/platform-1.3.6.tgz#48b4ce983164b209c2d45a107adb31f473a6e7a7" + integrity sha512-fnWVljUchTro6RiCFvCXBbNhJc2NijN7oIQxbwsyL0buWJPG85v81ehlHI9fXrJsMNgTofEoWIQeClKpgxFLrg== + possible-typed-array-names@^1.0.0: version "1.0.0" resolved "https://registry.npmjs.org/possible-typed-array-names/-/possible-typed-array-names-1.0.0.tgz"