Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Using @next/thirt-parties for GA, TS fix #22

Merged
merged 2 commits into from
Feb 22, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions pkgs/hanzo-ui/next/analytics/fpixel.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
declare global {
interface Window {
fbq: Function;
}
}

export const FB_PIXEL_ID = process.env.NEXT_PUBLIC_FACEBOOK_PIXEL_ID

export const pageview = () => {
Expand Down
47 changes: 0 additions & 47 deletions pkgs/hanzo-ui/next/analytics/google-analytics.tsx

This file was deleted.

30 changes: 0 additions & 30 deletions pkgs/hanzo-ui/next/analytics/gtag.ts

This file was deleted.

5 changes: 2 additions & 3 deletions pkgs/hanzo-ui/next/root-layout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import Header from '../common/header'
import type { SiteDef } from '../types'
import getAppRouterBodyFontClasses from './get-app-router-font-classes'
import { FacebookPixelHead, FacebookPixel } from './analytics/pixel-analytics'
import { GoogleAnalytics, GoogleAnalyticsHead } from './analytics/google-analytics'
import { GoogleAnalytics } from '@next/third-parties/google'

// Next 14: https://nextjs.org/docs/app/building-your-application/upgrading/codemods#use-viewport-export
const viewport = {
Expand Down Expand Up @@ -42,11 +42,10 @@ const RootLayout: React.FC<PropsWithChildren & {
{/* https://stackoverflow.com/a/75716588/11645689 */ }
<base target='_blank' />
<FacebookPixelHead/>
<GoogleAnalyticsHead/>
</head>
<body className={bodyClasses}>
<FacebookPixel />
<GoogleAnalytics />
<GoogleAnalytics gaId={process.env.NEXT_PUBLIC_GA_MEASUREMENT_ID} />
{header && <Header siteDef={siteDef}/>}
{children}
</body>
Expand Down
1 change: 1 addition & 0 deletions pkgs/hanzo-ui/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@
},
"dependencies": {
"@hookform/resolvers": "^3.3.2",
"@next/third-parties": "^14.1.0",
"@radix-ui/react-accordion": "^1.1.2",
"@radix-ui/react-avatar": "^1.0.3",
"@radix-ui/react-checkbox": "^1.0.4",
Expand Down
18 changes: 18 additions & 0 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading