Clean posthog

This commit is contained in:
MartinBraquet
2025-11-02 21:15:09 +01:00
parent c5f3e8b3c2
commit 3df9d067d6
2 changed files with 26 additions and 23 deletions

View File

@@ -27,18 +27,18 @@ export async function track(name: string, properties?: EventIds & EventData) {
export function initTracking() {
posthog.init(ENV_CONFIG.posthogKey, {
api_host: '/ingest',
ui_host: 'https://us.posthog.com',
api_host: 'https://us.i.posthog.com',
// ui_host: 'https://us.posthog.com',
loaded: (posthog) => {
posthog.debug(false)
},
// Below was a failed attempt to remove that error in the browser console:
// Cookie “dmn_chk_01993ec4-8420-79ca-85d3-28fec41426c0” has been rejected for invalid domain.
persistence: 'cookie',
cross_subdomain_cookie: true, // top-level domain cookie
secure_cookie: window.location.protocol === 'https:',
cookie_expiration: 365,
capture_pageview: true,
// persistence: 'cookie',
// cross_subdomain_cookie: true, // top-level domain cookie
// secure_cookie: window.location.protocol === 'https:',
// cookie_expiration: 365,
// capture_pageview: true,
})
}

View File

@@ -23,22 +23,25 @@ module.exports = {
experimental: {
scrollRestoration: true,
},
rewrites: async () => {
return [
{
source: '/ingest/static/:path*',
destination: 'https://us-assets.i.posthog.com/static/:path*',
},
{
source: '/ingest/:path*',
destination: 'https://us.i.posthog.com/:path*',
},
{
source: '/ingest/decide',
destination: 'https://us.i.posthog.com/decide',
},
]
},
// rewrites: async () => {
// if (isAppBuild) {
// return []
// }
// return [
// {
// source: '/ingest/static/:path*',
// destination: 'https://us-assets.i.posthog.com/static/:path*',
// },
// {
// source: '/ingest/:path*',
// destination: 'https://us.i.posthog.com/:path*',
// },
// {
// source: '/ingest/decide',
// destination: 'https://us.i.posthog.com/decide',
// },
// ]
// },
skipTrailingSlashRedirect: true,
images: {
unoptimized: isAppBuild,