feat(analytics): add Rybbit proxy rewrites and env vars
Some checks failed
Build and Deploy / build (push) Has been cancelled
Some checks failed
Build and Deploy / build (push) Has been cancelled
- Add Next.js rewrites to proxy /api/script.js and /api/track through self-hosted Rybbit - This bypasses ad blockers that would block rybbit.nodecrew.me directly - Add NEXT_PUBLIC_RYBBIT_HOST and NEXT_PUBLIC_RYBBIT_SITE_ID env vars to K8s deployment
This commit is contained in:
@@ -126,6 +126,10 @@ spec:
|
|||||||
value: "91126be0d1e78e657e0427df82733832.c6d30edf6ee673da9650a883604169a13ab8579a0dde70cb39b477f4cf441f90"
|
value: "91126be0d1e78e657e0427df82733832.c6d30edf6ee673da9650a883604169a13ab8579a0dde70cb39b477f4cf441f90"
|
||||||
- name: OPENPANEL_API_URL
|
- name: OPENPANEL_API_URL
|
||||||
value: "https://op.nodecrew.me/api"
|
value: "https://op.nodecrew.me/api"
|
||||||
|
- name: NEXT_PUBLIC_RYBBIT_HOST
|
||||||
|
value: "https://rybbit.nodecrew.me"
|
||||||
|
- name: NEXT_PUBLIC_RYBBIT_SITE_ID
|
||||||
|
value: "1"
|
||||||
resources:
|
resources:
|
||||||
limits:
|
limits:
|
||||||
cpu: 500m
|
cpu: 500m
|
||||||
|
|||||||
@@ -5,6 +5,19 @@ const withNextIntl = createNextIntlPlugin();
|
|||||||
|
|
||||||
const nextConfig: NextConfig = {
|
const nextConfig: NextConfig = {
|
||||||
output: 'standalone',
|
output: 'standalone',
|
||||||
|
async rewrites() {
|
||||||
|
const rybbitHost = process.env.NEXT_PUBLIC_RYBBIT_HOST || "https://rybbit.nodecrew.me";
|
||||||
|
return [
|
||||||
|
{
|
||||||
|
source: "/api/script.js",
|
||||||
|
destination: `${rybbitHost}/api/script.js`,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
source: "/api/track",
|
||||||
|
destination: `${rybbitHost}/api/track`,
|
||||||
|
},
|
||||||
|
];
|
||||||
|
},
|
||||||
images: {
|
images: {
|
||||||
remotePatterns: [
|
remotePatterns: [
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -5,9 +5,8 @@ import { SUPPORTED_LOCALES, DEFAULT_LOCALE, isValidLocale } from "@/lib/i18n/loc
|
|||||||
import { OpenPanelComponent } from "@openpanel/nextjs";
|
import { OpenPanelComponent } from "@openpanel/nextjs";
|
||||||
import Script from "next/script";
|
import Script from "next/script";
|
||||||
|
|
||||||
// Rybbit configuration - defined inline to avoid client directive issues
|
// Rybbit configuration
|
||||||
const RYBBIT_HOST = "https://rybbit.nodecrew.me";
|
const RYBBIT_SITE_ID = process.env.NEXT_PUBLIC_RYBBIT_SITE_ID || "1";
|
||||||
const RYBBIT_SITE_ID = "1";
|
|
||||||
|
|
||||||
const baseUrl = process.env.NEXT_PUBLIC_SITE_URL || "https://manoonoils.com";
|
const baseUrl = process.env.NEXT_PUBLIC_SITE_URL || "https://manoonoils.com";
|
||||||
|
|
||||||
@@ -59,7 +58,7 @@ export default async function LocaleLayout({
|
|||||||
scriptUrl="https://op.nodecrew.me/op1.js"
|
scriptUrl="https://op.nodecrew.me/op1.js"
|
||||||
/>
|
/>
|
||||||
<Script
|
<Script
|
||||||
src={`${RYBBIT_HOST}/api/script.js`}
|
src="/api/script.js"
|
||||||
data-site-id={RYBBIT_SITE_ID}
|
data-site-id={RYBBIT_SITE_ID}
|
||||||
strategy="afterInteractive"
|
strategy="afterInteractive"
|
||||||
/>
|
/>
|
||||||
|
|||||||
@@ -12,8 +12,8 @@ declare global {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
export const RYBBIT_HOST = "https://rybbit.nodecrew.me";
|
export const RYBBIT_HOST = process.env.NEXT_PUBLIC_RYBBIT_HOST || "https://rybbit.nodecrew.me";
|
||||||
export const RYBBIT_SITE_ID = "1";
|
export const RYBBIT_SITE_ID = process.env.NEXT_PUBLIC_RYBBIT_SITE_ID || "1";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Check if Rybbit is loaded and available
|
* Check if Rybbit is loaded and available
|
||||||
|
|||||||
Reference in New Issue
Block a user