-
Notifications
You must be signed in to change notification settings - Fork 3
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 #3 from fredygerman/develop
Develop
- Loading branch information
Showing
19 changed files
with
1,282 additions
and
1,096 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,5 @@ | ||
{ | ||
"typescript.tsdk": "../../node_modules/.pnpm/[email protected]/node_modules/typescript/lib", | ||
"typescript.enablePromptUseWorkspaceTsdk": true | ||
"typescript.enablePromptUseWorkspaceTsdk": true, | ||
"cSpell.words": ["posthog"] | ||
} |
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 |
---|---|---|
@@ -0,0 +1,47 @@ | ||
"use client" | ||
|
||
import { ReactNode, useEffect } from "react" | ||
import Link from "next/link" | ||
import posthog from "posthog-js" | ||
|
||
export function AdvancedLink({ | ||
children, | ||
href, // Extract href directly | ||
className, // Extract className directly | ||
onClick, // Extract onClick directly | ||
analyticsValue, // Extract analyticsValue directly | ||
analyticsProperties, // Extract analyticsProperties directly | ||
// any other props that come through | ||
...props | ||
}: { | ||
children: ReactNode | ||
href: string | ||
className?: string | ||
onClick?: () => void | ||
analyticsValue?: string | ||
analyticsProperties?: object | null | ||
[key: string]: any | ||
}) { | ||
const captureEvent = () => { | ||
// Add Posthog tracking when the component is clicked. | ||
if (analyticsValue) { | ||
posthog?.capture(`${analyticsValue ?? "clicked_link"}`, { | ||
properties: analyticsProperties ?? {}, | ||
}) | ||
} | ||
} | ||
|
||
return ( | ||
<Link | ||
href={href} | ||
className={className ?? ""} | ||
onClick={(e) => { | ||
captureEvent() | ||
onClick && onClick() | ||
}} | ||
{...props} | ||
> | ||
{children} | ||
</Link> | ||
) | ||
} |
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 |
---|---|---|
@@ -0,0 +1,21 @@ | ||
"use client" | ||
|
||
import posthog from "posthog-js" | ||
import { PostHogProvider } from "posthog-js/react" | ||
|
||
export function CustomPostHogProvider({ children }: any) { | ||
// Check that PostHog is client-side (used to handle Next.js SSR) | ||
if (typeof window !== "undefined") { | ||
posthog.init(process.env.POSTHOG_KEY || "", { | ||
api_host: process.env.POSTHOG_HOST_URL || "https://app.posthog.com", | ||
// Enable debug mode in development | ||
loaded: (posthog) => { | ||
if (process.env.NODE_ENV === "development") posthog.debug() | ||
console.log("PostHog debug enabled") | ||
}, | ||
capture_pageview: true, | ||
}) | ||
} | ||
|
||
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
Oops, something went wrong.