mirror of
https://github.com/d0zingcat/nextjs-notion-starter-kit.git
synced 2026-05-13 15:09:47 +00:00
🛣
This commit is contained in:
@@ -9,7 +9,6 @@ import { parsePageId } from 'notion-utils'
|
||||
import posthog from 'posthog-js'
|
||||
import { getEnv, getSiteConfig } from './get-config-value'
|
||||
import { PageUrlOverridesInverseMap, PageUrlOverridesMap } from './types'
|
||||
import Config = posthog.Config
|
||||
|
||||
export const rootNotionPageId: string = parsePageId(
|
||||
getSiteConfig('rootNotionPageId'),
|
||||
@@ -128,15 +127,9 @@ export const fathomConfig = fathomId
|
||||
}
|
||||
: undefined
|
||||
|
||||
// PostHog automatically filters events coming from localhost
|
||||
export const postHogId = process.env.NEXT_PUBLIC_POSTHOG_ID
|
||||
export const postHogConfig: Config = {
|
||||
// See https://posthog.com/docs/integrate/client/js#config
|
||||
api_host: 'https://app.posthog.com',
|
||||
loaded: (posthog_instance) => {
|
||||
console.debug(`PostHog loaded`, posthog_instance)
|
||||
// posthog_instance.identify(unique user id)
|
||||
}
|
||||
export const posthogId = process.env.NEXT_PUBLIC_POSTHOG_ID
|
||||
export const posthogConfig: posthog.Config = {
|
||||
api_host: 'https://app.posthog.com'
|
||||
}
|
||||
|
||||
function cleanPageUrlMap(
|
||||
|
||||
@@ -29,8 +29,7 @@ import 'styles/prism-theme.css'
|
||||
import React from 'react'
|
||||
import { useRouter } from 'next/router'
|
||||
import { bootstrap } from 'lib/bootstrap-client'
|
||||
import { fathomId, fathomConfig } from 'lib/config'
|
||||
import { postHogId, postHogConfig } from 'lib/config'
|
||||
import { fathomId, fathomConfig, posthogId, posthogConfig } from 'lib/config'
|
||||
import * as Fathom from 'fathom-client'
|
||||
import posthog from 'posthog-js'
|
||||
|
||||
@@ -46,7 +45,8 @@ export default function App({ Component, pageProps }) {
|
||||
if (fathomId) {
|
||||
Fathom.trackPageview()
|
||||
}
|
||||
if (postHogId) {
|
||||
|
||||
if (posthogId) {
|
||||
posthog.capture('$pageview')
|
||||
}
|
||||
}
|
||||
@@ -54,11 +54,9 @@ export default function App({ Component, pageProps }) {
|
||||
if (fathomId) {
|
||||
Fathom.load(fathomId, fathomConfig)
|
||||
}
|
||||
if (postHogId) {
|
||||
posthog.init(postHogId, postHogConfig)
|
||||
}
|
||||
if(!fathomId && !postHogId) {
|
||||
console.debug('No Analytics id provided.')
|
||||
|
||||
if (posthogId) {
|
||||
posthog.init(posthogId, posthogConfig)
|
||||
}
|
||||
|
||||
router.events.on('routeChangeComplete', onRouteChangeComplete)
|
||||
|
||||
Reference in New Issue
Block a user