diff --git a/package.json b/package.json index 74ef4d5..cf8f45b 100644 --- a/package.json +++ b/package.json @@ -38,6 +38,7 @@ "lighthouse": "^12.2.0", "mermaid": "^11.3.0", "nodemailer": "^6.9.14", + "posthog-node": "^4.2.1", "react": "^18.3.1", "react-dom": "^18.3.1", "resend": "^4.0.0", diff --git a/src/components/BaseHead.astro b/src/components/BaseHead.astro index aa2f2b1..ea4e9fe 100644 --- a/src/components/BaseHead.astro +++ b/src/components/BaseHead.astro @@ -15,7 +15,7 @@ const { title, description, image = "/open-graph.jpg" } = Astro.props - + diff --git a/src/components/Header.astro b/src/components/Header.astro index 9291c62..31c1e1f 100644 --- a/src/components/Header.astro +++ b/src/components/Header.astro @@ -15,7 +15,7 @@ import Container from "@components/Container.astro" --> - HuskyNZ Logo + HuskyNZ Logo
{SITE.TITLE}
diff --git a/src/layouts/PageLayout.astro b/src/layouts/PageLayout.astro index 1c3f8d4..0e567f1 100644 --- a/src/layouts/PageLayout.astro +++ b/src/layouts/PageLayout.astro @@ -6,14 +6,12 @@ import Footer from "@components/Footer.astro"; import Drawer from "@components/Drawer.astro"; const { title, description } = Astro.props; import { SITE } from "@consts"; -import Feedback from "@components/feedback.astro"; --- - diff --git a/src/pages/index.astro b/src/pages/index.astro index 88ebd98..d96ac1d 100644 --- a/src/pages/index.astro +++ b/src/pages/index.astro @@ -16,6 +16,16 @@ const projects = (await getCollection("projects")) .filter(project => !project.data.draft) .sort((a, b) => b.data.date.getTime() - a.data.date.getTime()) .slice(0,3) + + import PostHogClient from './posthog.js'; + +const phClient = PostHogClient(); +phClient.capture( + { + event: 'server_side_event', + distinctId: 'ian@posthog.com' + } +); --- diff --git a/src/pages/posthog.js b/src/pages/posthog.js new file mode 100644 index 0000000..b652b85 --- /dev/null +++ b/src/pages/posthog.js @@ -0,0 +1,13 @@ +// src/posthog.js +import { PostHog } from 'posthog-node'; + +let posthogClient = null; + +export default function PostHogClient() { + if (!posthogClient) { + posthogClient = new PostHog('phc_Y4kGHU5J5btw0tP4ya10FbKXKQdm9RB1LeB6Df4KW0Q', { + host: 'https://eu.i.posthog.com', + }); + } + return posthogClient; +} \ No newline at end of file diff --git a/yarn.lock b/yarn.lock index 12e94c9..b3017d2 100644 --- a/yarn.lock +++ b/yarn.lock @@ -2390,6 +2390,11 @@ async-sema@^3.1.1: resolved "https://registry.yarnpkg.com/async-sema/-/async-sema-3.1.1.tgz#e527c08758a0f8f6f9f15f799a173ff3c40ea808" integrity sha512-tLRNUXati5MFePdAk8dw7Qt7DpxPB60ofAgn8WRhW6a2rcimZnYBP9oxHiv0OHy+Wz7kPMG+t4LGdt31+4EmGg== +asynckit@^0.4.0: + version "0.4.0" + resolved "https://registry.yarnpkg.com/asynckit/-/asynckit-0.4.0.tgz#c79ed97f7f34cb8f2ba1bc9790bcc366474b4b79" + integrity sha512-Oei9OH4tRh0YqU3GxhX79dM/mwVgvbZJaSNaRk+bshkj0S5cfHcgYakreBjrHwatXKbz+IoIdYLxrKim2MjW0Q== + autoprefixer@^10.4.15: version "10.4.19" resolved "https://registry.npmjs.org/autoprefixer/-/autoprefixer-10.4.19.tgz" @@ -2407,6 +2412,15 @@ axe-core@^4.9.1: resolved "https://registry.yarnpkg.com/axe-core/-/axe-core-4.10.0.tgz#d9e56ab0147278272739a000880196cdfe113b59" integrity sha512-Mr2ZakwQ7XUAjp7pAwQWRhhK8mQQ6JAaNWSjmjxil0R8BPioMtQsTLOolGYkji1rcL++3dCqZA3zWqpT+9Ew6g== +axios@^1.7.4: + version "1.7.7" + resolved "https://registry.yarnpkg.com/axios/-/axios-1.7.7.tgz#2f554296f9892a72ac8d8e4c5b79c14a91d0a47f" + integrity sha512-S4kL7XrjgBmvdGut0sN3yJxqYzrDOnivkBiN0OFs6hLiUam3UPvswUo0kqGyhqUZGEOytHyumEdXsAkgCOUf3Q== + dependencies: + follow-redirects "^1.15.6" + form-data "^4.0.0" + proxy-from-env "^1.1.0" + axobject-query@^4.1.0: version "4.1.0" resolved "https://registry.npmjs.org/axobject-query/-/axobject-query-4.1.0.tgz" @@ -2899,6 +2913,13 @@ color@^4.2.3: color-convert "^2.0.1" color-string "^1.9.0" +combined-stream@^1.0.8: + version "1.0.8" + resolved "https://registry.yarnpkg.com/combined-stream/-/combined-stream-1.0.8.tgz#c3d45a8b34fd730631a110a8a2520682b31d5a7f" + integrity sha512-FQN4MRfuJeHf7cBbBMJFXhKSDq+2kAArBlmRBvcvFE5BB1HZKXtSFASDhdlz9zOYwxh8lDdnvmMOe/+5cdoEdg== + dependencies: + delayed-stream "~1.0.0" + comma-separated-tokens@^2.0.0: version "2.0.3" resolved "https://registry.npmjs.org/comma-separated-tokens/-/comma-separated-tokens-2.0.3.tgz" @@ -3429,6 +3450,11 @@ delaunator@5: dependencies: robust-predicates "^3.0.2" +delayed-stream@~1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/delayed-stream/-/delayed-stream-1.0.0.tgz#df3ae199acadfb7d440aaae0b29e2272b24ec619" + integrity sha512-ZySD7Nf91aLB0RxL4KGrKHBXl7Eds1DAmEdcoVawXnLD7SDhpNgtuII2aAkg7a7QS41jxPSZ17p4VdGnMHk3MQ== + delegates@^1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/delegates/-/delegates-1.0.0.tgz#84c6e159b81904fdca59a0ef44cd870d31250f9a" @@ -3997,6 +4023,11 @@ flattie@^1.1.1: resolved "https://registry.npmjs.org/flattie/-/flattie-1.1.1.tgz" integrity sha512-9UbaD6XdAL97+k/n+N7JwX46K/M6Zc6KcFYskrYL8wbBV/Uyk0CTAMY0VT+qiK5PM7AIc9aTWYtq65U7T+aCNQ== +follow-redirects@^1.15.6: + version "1.15.9" + resolved "https://registry.yarnpkg.com/follow-redirects/-/follow-redirects-1.15.9.tgz#a604fa10e443bf98ca94228d9eebcc2e8a2c8ee1" + integrity sha512-gew4GsXizNgdoRyqmyfMHyAmXsZDk6mHkSxZFCzW9gwlbtOW44CDtYavM+y+72qD/Vq2l550kMF52DT8fOLJqQ== + foreground-child@^3.1.0: version "3.2.1" resolved "https://registry.npmjs.org/foreground-child/-/foreground-child-3.2.1.tgz" @@ -4005,6 +4036,15 @@ foreground-child@^3.1.0: cross-spawn "^7.0.0" signal-exit "^4.0.1" +form-data@^4.0.0: + version "4.0.1" + resolved "https://registry.yarnpkg.com/form-data/-/form-data-4.0.1.tgz#ba1076daaaa5bfd7e99c1a6cb02aa0a5cff90d48" + integrity sha512-tzN8e4TX8+kkxGPK8D5u0FNmjPUjw3lwC9lSLxxoB/+GtsJG91CO8bSWy73APlgAZzZbXEYZJuxjkHH2w+Ezhw== + dependencies: + asynckit "^0.4.0" + combined-stream "^1.0.8" + mime-types "^2.1.12" + fraction.js@^4.3.7: version "4.3.7" resolved "https://registry.npmjs.org/fraction.js/-/fraction.js-4.3.7.tgz" @@ -6152,6 +6192,18 @@ micromatch@^4.0.2, micromatch@^4.0.4, micromatch@^4.0.5: braces "^3.0.3" picomatch "^2.3.1" +mime-db@1.52.0: + version "1.52.0" + resolved "https://registry.yarnpkg.com/mime-db/-/mime-db-1.52.0.tgz#bbabcdc02859f4987301c856e3387ce5ec43bf70" + integrity sha512-sPU4uV7dYlvtWJxwwxHD0PuihVNiE7TyAbQ5SWxDCB9mUYvOgroQOwYQQOKPJ8CIbE+1ETVlOoK1UC2nU3gYvg== + +mime-types@^2.1.12: + version "2.1.35" + resolved "https://registry.yarnpkg.com/mime-types/-/mime-types-2.1.35.tgz#381a871b62a734450660ae3deee44813f70d959a" + integrity sha512-ZDY+bPm5zTTF+YpCrAU9nK0UgICYPT0QtT1NZWFv4s++TNkcgVaT0g6+4R2uI4MjQjzysHB1zxuWL50hzaeXiw== + dependencies: + mime-db "1.52.0" + mime@1.6.0: version "1.6.0" resolved "https://registry.yarnpkg.com/mime/-/mime-1.6.0.tgz#32cd9e5c64553bd58d19a568af452acff04981b1" @@ -6780,6 +6832,14 @@ postcss@^8.4.23, postcss@^8.4.28, postcss@^8.4.39: picocolors "^1.0.1" source-map-js "^1.2.0" +posthog-node@^4.2.1: + version "4.2.1" + resolved "https://registry.yarnpkg.com/posthog-node/-/posthog-node-4.2.1.tgz#c9f077116bebd06dc65a3f9ae282d10db242c660" + integrity sha512-l+fsjYEkTik3m/G0pE7gMr4qBJP84LhK779oQm6MBzhBGpd4By4qieTW+4FUAlNCyzQTynn3Nhsa50c0IELSxQ== + dependencies: + axios "^1.7.4" + rusha "^0.8.14" + preferred-pm@^4.0.0: version "4.0.0" resolved "https://registry.npmjs.org/preferred-pm/-/preferred-pm-4.0.0.tgz" @@ -7262,6 +7322,11 @@ run-parallel@^1.1.9: dependencies: queue-microtask "^1.2.2" +rusha@^0.8.14: + version "0.8.14" + resolved "https://registry.yarnpkg.com/rusha/-/rusha-0.8.14.tgz#a977d0de9428406138b7bb90d3de5dcd024e2f68" + integrity sha512-cLgakCUf6PedEu15t8kbsjnwIFFR2D4RfL+W3iWFJ4iac7z4B0ZI8fxy4R3J956kAI68HclCFGL8MPoUVC3qVA== + rw@1: version "1.3.3" resolved "https://registry.yarnpkg.com/rw/-/rw-1.3.3.tgz#3f862dfa91ab766b14885ef4d01124bfda074fb4"