Skip to content

Open-source status page, incident response and uptime monitoring

🕵️ add analytics

Thibault Le Ouay870245c3c882
diff --git a/apps/docs/package.json b/apps/docs/package.json
index fa025c712..ce58620f3 100644
--- a/apps/docs/package.json
+++ b/apps/docs/package.json
@@ -11,6 +11,7 @@
},
"homepage": "https://openstatus.dev",
"dependencies": {
+ "@vercel/analytics": "^1.0.1",
"next": "^13.4.12",
"nextra": "2.10.0",
"nextra-theme-docs": "2.10.0",
diff --git a/apps/docs/pages/_app.tsx b/apps/docs/pages/_app.tsx
new file mode 100644
index 000000000..ea2fc7ac9
--- /dev/null
+++ b/apps/docs/pages/_app.tsx
@@ -0,0 +1,13 @@
+import type { AppProps } from "next/app";
+import { Analytics } from "@vercel/analytics/react";
+
+function MyApp({ Component, pageProps }: AppProps) {
+ return (
+ <>
+ <Component {...pageProps} />
+ <Analytics />
+ </>
+ );
+}
+
+export default MyApp;
diff --git a/apps/docs/pages/_meta.json b/apps/docs/pages/_meta.json
index 856193e0c..e81f6e1f2 100644
--- a/apps/docs/pages/_meta.json
+++ b/apps/docs/pages/_meta.json
@@ -1,7 +1,6 @@
{
"index": "Introduction",
"get-started": "Get Started",
- "community": "Community",
"contact": {
"title": "🌐 Website",
diff --git a/apps/docs/pages/get-started/_meta.json b/apps/docs/pages/get-started/_meta.json
index f2e62d4fe..48f589997 100644
--- a/apps/docs/pages/get-started/_meta.json
+++ b/apps/docs/pages/get-started/_meta.json
@@ -1,5 +1,6 @@
{
"requirements": "Requirements",
"setup": "Setup",
- "setup-env": "Setup environment files"
+ "setup-env": "Setup environment files",
+ "get-started": "Get started"
}
diff --git a/apps/docs/pages/community/contributing-guide.mdx b/apps/docs/pages/get-started/get-started.mdx
similarity index 80%
rename from apps/docs/pages/community/contributing-guide.mdx
rename to apps/docs/pages/get-started/get-started.mdx
index 0acaed962..c14acf7cc 100644
--- a/apps/docs/pages/community/contributing-guide.mdx
+++ b/apps/docs/pages/get-started/get-started.mdx
@@ -1,12 +1,3 @@
-# Docs Contribution Guide
-
-Welcome to the OpenStatus Docs Contribution Guide! We're excited to have you
-here.
-
-This page provides instructions on how to edit the OpenStatus documentation. Our
-goal is to ensure that everyone in the community feels empowered to contribute
-and improve our docs.
-
## Setup
1. Clone the repository
diff --git a/apps/docs/pages/get-started/requirements.mdx b/apps/docs/pages/get-started/requirements.mdx
index 4a2aa0237..1b9dff327 100644
--- a/apps/docs/pages/get-started/requirements.mdx
+++ b/apps/docs/pages/get-started/requirements.mdx
@@ -74,3 +74,8 @@ file.
Please note that these optional requirements are only necessary if you want to
use a local database. Otherwise, you can continue with the rest of the
configuration as mentioned previously.
+
+### **_Installing Turso_**
+
+If you want to run Turso locally you can follow the instructions in the (Turso
+CLI)[https://docs.turso.tech/reference/turso-cli]
diff --git a/apps/web/package.json b/apps/web/package.json
index 3f15eb7ca..0f6b6c2c2 100644
--- a/apps/web/package.json
+++ b/apps/web/package.json
@@ -42,6 +42,7 @@
"@trpc/server": "10.35.0",
"@upstash/qstash": "0.3.6",
"@upstash/redis": "1.21.0",
+ "@vercel/analytics": "1.0.1",
"class-variance-authority": "0.6.0",
"clsx": "1.2.1",
"cmdk": "0.2.0",
diff --git a/apps/web/src/app/_components/analytics.tsx b/apps/web/src/app/_components/analytics.tsx
new file mode 100644
index 000000000..09118afdf
--- /dev/null
+++ b/apps/web/src/app/_components/analytics.tsx
@@ -0,0 +1,30 @@
+"use client";
+
+import { Analytics } from "@vercel/analytics/react";
+
+export const ClientAnalytics = () => {
+ const getSubdomain = (url: string) => {
+ let domain = url;
+ if (url.includes("://")) {
+ domain = url.split("://")[1];
+ }
+ const subdomain = domain.split(".")[0];
+ return subdomain;
+ };
+
+ return (
+ <Analytics
+ beforeSend={(event) => {
+ console.log(event);
+ // Ignore all events that have a `/private` inside the URL
+ if (event.url.match("https://((?!www).*).openstatus.dev")) {
+ return {
+ ...event,
+ url: `/status-page/${getSubdomain(event.url)}`,
+ };
+ }
+ return event;
+ }}
+ />
+ );
+};
diff --git a/apps/web/src/app/layout.tsx b/apps/web/src/app/layout.tsx
index c8f7abf78..999398b18 100644
--- a/apps/web/src/app/layout.tsx
+++ b/apps/web/src/app/layout.tsx
@@ -4,10 +4,12 @@ import type { Metadata } from "next";
import { Inter } from "next/font/google";
import LocalFont from "next/font/local";
import { ClerkProvider } from "@clerk/nextjs";
+import { Analytics } from "@vercel/analytics/react";
import PlausibleProvider from "next-plausible";
import { TailwindIndicator } from "@/components/tailwind-indicator";
import { Toaster } from "@/components/ui/toaster";
+import { ClientAnalytics } from "./_components/analytics";
import Background from "./_components/background";
const inter = Inter({ subsets: ["latin"] });
@@ -55,6 +57,7 @@ export default function RootLayout({
<TailwindIndicator />
</body>
</PlausibleProvider>
+ <ClientAnalytics />;
</html>
</ClerkProvider>
);
diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml
index 7e415f576..bc9176f31 100644
--- a/pnpm-lock.yaml
+++ b/pnpm-lock.yaml
@@ -44,6 +44,9 @@ importers:
apps/docs:
dependencies:
+ '@vercel/analytics':
+ specifier: ^1.0.1
+ version: 1.0.1
next:
specifier: ^13.4.12
@@ -168,6 +171,9 @@ importers:
'@upstash/redis':
specifier: 1.21.0
version: 1.21.0
+ '@vercel/analytics':
+ specifier: 1.0.1
+ version: 1.0.1
class-variance-authority:
specifier: 0.6.0
version: 0.6.0([email protected])
@@ -5446,6 +5452,10 @@ packages:
- encoding
dev: false
+ /@vercel/[email protected]:
+ resolution: {integrity: sha512-Ux0c9qUfkcPqng3vrR0GTrlQdqNJ2JREn/2ydrVuKwM3RtMfF2mWX31Ijqo1opSjNAq6rK76PwtANw6kl6TAow==}
+ dev: false
+
resolution: {integrity: sha512-nne9/IiQ/hzIhY6pdDnbBtz7DjPTKrY00P/zvPSm5pOFkl6xuGrGnXn/VtTNNfNtAfZ9/1RtehkszU9qcTii0Q==}
dev: false