From 1a3bc92e63904bec8b1eff9444af8b500cfec4e3 Mon Sep 17 00:00:00 2001
From: heheer <1239331448@qq.com>
Date: Thu, 31 Oct 2024 16:30:01 +0800
Subject: [PATCH 1/2] feat: add baidu conversion tracking
---
projects/fastgpt/app/BdVidHandler.tsx | 12 ++++++++++++
projects/fastgpt/app/layout.tsx | 2 ++
projects/fastgpt/components/header/LangSwitcher.tsx | 7 ++-----
projects/fastgpt/components/home/CTAButton.tsx | 7 ++++++-
4 files changed, 22 insertions(+), 6 deletions(-)
create mode 100644 projects/fastgpt/app/BdVidHandler.tsx
diff --git a/projects/fastgpt/app/BdVidHandler.tsx b/projects/fastgpt/app/BdVidHandler.tsx
new file mode 100644
index 0000000..fc5e914
--- /dev/null
+++ b/projects/fastgpt/app/BdVidHandler.tsx
@@ -0,0 +1,12 @@
+'use client';
+
+export default function BdVidHandler() {
+ if (typeof window !== 'undefined') {
+ const urlParams = new URLSearchParams(window.location.search);
+ const bd_vid = urlParams.get('bd_vid');
+ if (bd_vid) {
+ localStorage.setItem('bd_vid', bd_vid);
+ }
+ }
+ return null;
+}
\ No newline at end of file
diff --git a/projects/fastgpt/app/layout.tsx b/projects/fastgpt/app/layout.tsx
index eb6b707..8f01536 100644
--- a/projects/fastgpt/app/layout.tsx
+++ b/projects/fastgpt/app/layout.tsx
@@ -12,6 +12,7 @@ import { Analytics } from '@vercel/analytics/react';
import { Viewport } from 'next';
import { Inter as FontSans } from 'next/font/google';
import Script from 'next/script';
+import BdVidHandler from './BdVidHandler';
const fontSans = FontSans({
subsets: ['latin'],
@@ -83,6 +84,7 @@ export default async function RootLayout({
+