threshold-network / website

1 stars 10 forks source link

Posthog #59

Closed r-czajkowski closed 1 year ago

r-czajkowski commented 1 year ago

This PR adds posthog analystic tool to the T website. We want to enable the posthog on the production build only so here we pass the POSTHOG_SUPPORT: true env variable in CI during the production build.

How to test the posthog locally?

  1. Update the posthog plugin config in gatsby-config.ts file:
    if (process.env["POSTHOG_SUPPORT"] === "true") {
    plugins.push({
     resolve: "gatsby-plugin-posthog",
     options: {
      apiKey: process.env["POSTHOG_API_KEY"],
      apiHost: process.env["POSTHOG_HOSTNAME_HTTP"],
      isEnabledDevMode: true,
      initOptions: {
       persistence: "memory",
       debug: true,
      },
     },
    })
    }
  2. POSTHOG_API_KEY=<api_key> POSTHOG_HOSTNAME_HTTP=https://app.posthog.com/ POSTHOG_SUPPORT=true yarn start
github-actions[bot] commented 1 year ago

Preview uploaded to https://preview.threshold.network/posthog/index.html.

github-actions[bot] commented 1 year ago

Preview uploaded to https://preview.threshold.network/posthog/index.html.