-
Notifications
You must be signed in to change notification settings - Fork 27
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #25 from zolplay-cn/dev
Prod bump
- Loading branch information
Showing
8 changed files
with
136 additions
and
106 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
'use client' | ||
|
||
import { usePathname, useSearchParams } from 'next/navigation' | ||
import posthog from 'posthog-js' | ||
import { PostHogProvider } from 'posthog-js/react' | ||
import { useEffect } from 'react' | ||
|
||
if (typeof window !== 'undefined' && process.env.NEXT_PUBLIC_POSTHOG_KEY) { | ||
posthog.init(process.env.NEXT_PUBLIC_POSTHOG_KEY, { | ||
api_host: process.env.NEXT_PUBLIC_POSTHOG_HOST, | ||
capture_pageview: false, // Disable automatic pageview capture, as we capture manually | ||
}) | ||
} | ||
|
||
export function PostHogPageview() { | ||
const pathname = usePathname() | ||
const searchParams = useSearchParams() | ||
// Track pageviews | ||
useEffect(() => { | ||
if (pathname) { | ||
let url = window.origin + pathname | ||
if (searchParams && searchParams.toString()) { | ||
url = url + `?${searchParams.toString()}` | ||
} | ||
posthog.capture('$pageview', { | ||
$current_url: url, | ||
}) | ||
} | ||
}, [pathname, searchParams]) | ||
return <></> | ||
} | ||
|
||
export function PHProvider({ children }: { children: React.ReactNode }) { | ||
return <PostHogProvider client={posthog}>{children}</PostHogProvider> | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -17,7 +17,6 @@ | |
"@sanity/document-internationalization": "^1.1.1", | ||
"@sanity/image-url": "^1.0.2", | ||
"@sanity/vision": "^3.10.1", | ||
"@vercel/analytics": "^0.1.11", | ||
"@vercel/og": "^0.2.0", | ||
"@zolplay/react": "^0.5.1", | ||
"@zolplay/utils": "^1.3.4", | ||
|
@@ -32,6 +31,7 @@ | |
"next-intl": "2.14.0-beta.4", | ||
"next-sanity": "^4.3.2", | ||
"next-themes": "^0.2.1", | ||
"posthog-js": "^1.87.6", | ||
"react": "^18.2.0", | ||
"react-dom": "^18.2.0", | ||
"react-hook-form": "^7.43.9", | ||
|
@@ -66,6 +66,7 @@ | |
"tailwindcss": "^3.3.2", | ||
"typescript": "^4.9.5" | ||
}, | ||
"packageManager": "[email protected]", | ||
"pnpm": { | ||
"peerDependencyRules": { | ||
"ignoreMissing": [ | ||
|
Oops, something went wrong.
7b7df1e
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Successfully deployed to the following URLs:
website – ./
website-zolplay.vercel.app
www.zolplay.com
zolplay.com
website-git-main-zolplay.vercel.app