Skip to content

Commit

Permalink
Merge pull request #72 from huskynz/dev
Browse files Browse the repository at this point in the history
Add posthog, this will allow the gathering of feedback and insights about the site
  • Loading branch information
Husky-Devel authored Oct 24, 2024
2 parents 1dbbc00 + a5fd1c2 commit 8363a9d
Show file tree
Hide file tree
Showing 7 changed files with 91 additions and 4 deletions.
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
2 changes: 1 addition & 1 deletion src/components/BaseHead.astro
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ const { title, description, image = "/open-graph.jpg" } = Astro.props
<!-- Global Metadata -->
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width,initial-scale=1" />
<link rel="icon" type="image/png" href="https://serv.hnz.li/logo/default.png" />
<link rel="icon" type="image/png" href="https://serv.husky.nz/logo/default180.png" />
<meta name="generator" content={Astro.generator} />

<link rel="preload" href="/fonts/atkinson-regular.woff" as="font" type="font/woff" crossorigin>
Expand Down
2 changes: 1 addition & 1 deletion src/components/Header.astro
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ import Container from "@components/Container.astro"
<use href="/brand.svg#brand"></use>
</svg>
-->
<img src="https://serv.hnz.li/logo/default.png" class="size-6" alt="HuskyNZ Logo"/>
<img src="https://serv.husky.nz/logo/default180.png" class="size-6" alt="HuskyNZ Logo"/>
<div>
{SITE.TITLE}
</div>
Expand Down
2 changes: 0 additions & 2 deletions src/layouts/PageLayout.astro
Original file line number Diff line number Diff line change
Expand Up @@ -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";
---

<!doctype html>
<html lang="en">
<head>
<Feedback />
<BaseHead title={`${title} | ${SITE.TITLE}`} description={description} />
</head>
<body>
Expand Down
10 changes: 10 additions & 0 deletions src/pages/index.astro
Original file line number Diff line number Diff line change
Expand Up @@ -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'
}
);
---


Expand Down
13 changes: 13 additions & 0 deletions src/pages/posthog.js
Original file line number Diff line number Diff line change
@@ -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;
}
65 changes: 65 additions & 0 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand All @@ -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"
Expand Down Expand Up @@ -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"
Expand Down Expand Up @@ -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"
Expand Down Expand Up @@ -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"
Expand All @@ -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"
Expand Down Expand Up @@ -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"
Expand Down Expand Up @@ -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"
Expand Down Expand Up @@ -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"
Expand Down

0 comments on commit 8363a9d

Please sign in to comment.