This commit is contained in:
Vineeth Voruganti 2024-02-16 23:43:45 -08:00
parent d7c7136fef
commit d56b2181c0
3 changed files with 20 additions and 9 deletions

View File

@ -7,7 +7,7 @@ const config: QuartzConfig = {
enableSPA: true, enableSPA: true,
enablePopovers: true, enablePopovers: true,
analytics: { analytics: {
provider: "plausible", provider: "postHog",
}, },
baseUrl: "plasticlabs.ai", baseUrl: "plasticlabs.ai",
ignorePatterns: ["private", "templates"], ignorePatterns: ["private", "templates"],

View File

@ -6,16 +6,20 @@ import { Theme } from "./util/theme"
export type Analytics = export type Analytics =
| null | null
| { | {
provider: "plausible" provider: "plausible"
} }
| { | {
provider: "google" provider: "google"
tagId: string tagId: string
} }
| { | {
provider: "umami" provider: "umami"
websiteId: string websiteId: string
} }
| {
provider: "postHog"
}
export interface GlobalConfiguration { export interface GlobalConfiguration {
pageTitle: string pageTitle: string

View File

@ -105,6 +105,13 @@ function addGlobalPageResources(
document.head.appendChild(umamiScript) document.head.appendChild(umamiScript)
`) `)
} else if (cfg.analytics?.provider === "postHog") {
componentResources.afterDOMLoaded.push(
`
!function(t,e){var o,n,p,r;e.__SV||(window.posthog=e,e._i=[],e.init=function(i,s,a){function g(t,e){var o=e.split(".");2==o.length&&(t=t[o[0]],e=o[1]),t[e]=function(){t.push([e].concat(Array.prototype.slice.call(arguments,0)))}}(p=t.createElement("script")).type="text/javascript",p.async=!0,p.src=s.api_host+"/static/array.js",(r=t.getElementsByTagName("script")[0]).parentNode.insertBefore(p,r);var u=e;for(void 0!==a?u=e[a]=[]:a="posthog",u.people=u.people||[],u.toString=function(t){var e="posthog";return"posthog"!==a&&(e+="."+a),t||(e+=" (stub)"),e},u.people.toString=function(){return u.toString(1)+".people (stub)"},o="capture identify alias people.set people.set_once set_config register register_once unregister opt_out_capturing has_opted_out_capturing opt_in_capturing reset isFeatureEnabled onFeatureFlags getFeatureFlag getFeatureFlagPayload reloadFeatureFlags group updateEarlyAccessFeatureEnrollment getEarlyAccessFeatures getActiveMatchingSurveys getSurveys onSessionId".split(" "),n=0;n<o.length;n++)g(u,o[n]);e._i.push([i,s,a])},e.__SV=1)}(document,window.posthog||[]);
posthog.init('phc_gQ0zjg2pQPUEqhpVagoE84JhGIQSkttyv9ki1unG3Mh',{api_host:'https://app.posthog.com'})
`
)
} }
if (cfg.enableSPA) { if (cfg.enableSPA) {