@convex-internal/web-analytics 1.1.0 → 1.1.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,5 +1,5 @@
1
1
  import { type ReactNode } from "react";
2
- export declare const POSTHOG_KEY = "phc_JDNTRxeh2li2sQTRO0IcOYMJcp8fPs5nTK9TU751nQK";
2
+ export declare const POSTHOG_PUBLIC_PROJECT_TOKEN = "phc_JDNTRxeh2li2sQTRO0IcOYMJcp8fPs5nTK9TU751nQK";
3
3
  /**
4
4
  * `"unknown"` until the cookie has been read (SSR and first client render).
5
5
  * `"undecided"` when it has been read and there is no recognized choice.
@@ -4,9 +4,12 @@ import { posthog } from "posthog-js";
4
4
  import { createContext, useEffect } from "react";
5
5
  import { ConsentBanner } from "./ConsentBanner.js";
6
6
  import { useBooleanCookie } from "./useCookie.js";
7
- const COOKIE_NAME = "allowsCookies";
8
- export const POSTHOG_KEY = "phc_JDNTRxeh2li2sQTRO0IcOYMJcp8fPs5nTK9TU751nQK";
7
+ // PostHog project token for event ingest and feature flags. `phc_` tokens are
8
+ // public by design (browser JS, no env var) and cannot read private project data.
9
+ // https://posthog.com/docs/privacy#is-it-ok-for-my-api-key-to-be-exposed-and-public
10
+ export const POSTHOG_PUBLIC_PROJECT_TOKEN = "phc_JDNTRxeh2li2sQTRO0IcOYMJcp8fPs5nTK9TU751nQK";
9
11
  const POSTHOG_HOST = "https://ap.convex.dev";
12
+ const COOKIE_NAME = "allowsCookies";
10
13
  // GPC wins over the stored cookie and does not write it, so turning GPC off
11
14
  // restores the saved choice (or the banner if there is none). A missing or
12
15
  // unrecognized cookie after the read defaults to `"undecided"`.
@@ -42,7 +45,7 @@ export function WebAnalyticsProvider({ children }) {
42
45
  window.location.hostname === "[::1]") {
43
46
  return;
44
47
  }
45
- posthog.init(POSTHOG_KEY, {
48
+ posthog.init(POSTHOG_PUBLIC_PROJECT_TOKEN, {
46
49
  api_host: POSTHOG_HOST,
47
50
  ui_host: "https://us.posthog.com/",
48
51
  // Automatically capture navigations using the History API.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@convex-internal/web-analytics",
3
- "version": "1.1.0",
3
+ "version": "1.1.1",
4
4
  "type": "module",
5
5
  "exports": {
6
6
  ".": {