@hanzo/event 0.3.32 → 0.3.33

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.
package/README.md CHANGED
@@ -27,29 +27,27 @@ starve the other:
27
27
  > plane is **inert**: nothing is sent, nothing throws, analytics is unaffected.
28
28
  > Assert `client.errorPlaneEnabled` if you want to know which you have.
29
29
 
30
- ### No bundler? Use the `hz.js` tag — same client, same wire
30
+ ### No bundler? Use the hosted tag
31
31
 
32
32
  ```html
33
- <script async src="https://unpkg.com/@hanzo/event/hz.js"
34
- data-product="hanzo.ai"
35
- data-ingest-key="pk-…"
36
- data-capture="1"></script>
33
+ <script defer src="https://api.hanzo.ai/v1/event.js" data-key="pk-…"></script>
37
34
  ```
38
35
 
39
- > **`data-ingest-key` is required off the door's own origin**, and through
40
- > 0.3.11 this file could not present one at all no header, no query. A keyed
41
- > static surface therefore sent UNATTRIBUTED writes, which the door refuses
42
- > (`401 ingest_key_required`) silently, because nothing here reads the response.
43
- > The tag measured fine in the browser and filed nothing. It now rides
44
- > `Authorization: Bearer pk-…` on fetch and `?ingest_key=pk-…` on a headerless
45
- > unload beacon the same pair the npm client uses.
46
-
47
- `hz.js` (in this package) is the **script-tag distribution** of this client, for
48
- surfaces with no build step. It posts the SAME `{ batch: [WireEvent, …] }` to the
49
- SAME `POST {host}/v1/event`, and adds DOM **autocapture** `$click` (with an
50
- element locator), `$outbound`, `$scroll`, `$form`, `$vitals` which a bundled app
51
- does not need and a plain page cannot get. Manual API: `window.hanzo.track()` /
52
- `identify()` / `page()`.
36
+ That one line is the whole install, and it is the same line for a published site,
37
+ hanzo.team and a customer's own page. The tag is served by the door that eats the
38
+ events, so a caller allowlists ONE host and the tag can never drift from the wire
39
+ it posts to. It adds DOM **autocapture** `$click` (with an element locator),
40
+ `$outbound`, `$scroll`, `$form`, `$vitals` which a bundled app does not need and
41
+ a plain page cannot get, and it carries the site's tag config from `/v1/tags`, so a
42
+ pixel is configured on the project rather than pasted into the page.
43
+
44
+ > **`data-key` is a publishable `pk-`, and without one the tag is INERT.** A write
45
+ > the door cannot attribute is refused (`401 ingest_key_required`) silently, so a
46
+ > keyless tag measures fine in the browser and files nothing. Mint one with
47
+ > `POST /v1/keys {"type":"publishable"}`.
48
+
49
+ This package is the client for a surface that **builds**. There is no second
50
+ script-tag distribution here: one wire, one door, one tag.
53
51
 
54
52
  It honours the same consent sources the bundled stack does: an explicit stored
55
53
  choice (`hz_consent`, the key a Hanzo consent banner writes) outranks the browser
package/dist/index.cjs CHANGED
@@ -319,7 +319,7 @@ function uuidv7Time(id) {
319
319
  }
320
320
 
321
321
  // src/version.ts
322
- var VERSION = "0.3.32";
322
+ var VERSION = "0.3.33";
323
323
 
324
324
  // src/sentry.ts
325
325
  var MAX_FRAMES = 50;
@@ -1110,26 +1110,26 @@ var COHORTS = {
1110
1110
  channel: { field: "channel", label: "Acquisition channel" },
1111
1111
  refCode: { field: "ref_code", label: "Referral code" }
1112
1112
  };
1113
- /*! anon.js — THE anonymous-identity chain. ONE implementation, three distributions.
1113
+ /*! anon.js — THE anonymous-identity chain. ONE implementation, two distributions.
1114
1114
  *
1115
1115
  * One browser is ONE person on every Hanzo surface, whichever client a page
1116
- * happens to have loaded. There were three implementations writing TWO keys —
1117
- * `hz_anon_id` (the npm client, the hosted tag) and `hz_id` (hz.js) — so the same
1118
- * visitor was several people depending on which snippet the surface shipped.
1116
+ * happens to have loaded. There were once three implementations writing TWO keys —
1117
+ * `hz_anon_id` and `hz_id` — so the same visitor was several people depending on
1118
+ * which snippet the surface shipped.
1119
1119
  *
1120
- * The three call sites:
1120
+ * The two call sites:
1121
1121
  * 1. src/storage.ts — the bundled npm client; IMPORTS this file.
1122
- * 2. hz.js — the no-build script tag; INLINES the marked region.
1123
- * 3. hanzoai/cloud apps/analytics/tag.js — the tag the door hosts at
1122
+ * 2. hanzoai/cloud apps/analytics/tag.js — the tag the door hosts at
1124
1123
  * /v1/event.js; vendors this file and its tag.go serves the marked region
1125
1124
  * with the tag as one asset, so the door holds no second copy either.
1126
1125
  *
1127
- * (2) and (3) have no bundler and cannot import anything, which is why the chain
1128
- * lives in a file that is plain ES5 rather than in a .ts: the region between the
1129
- * BEGIN and END markers is COPIED VERBATIM, and src/anon.test.ts fails if hz.js's
1130
- * copy is so much as a byte different. Keep the region ES5, dependency-free,
1131
- * `hz`-prefixed (it is spliced into other people's scopes) and unformatted — a
1132
- * reformat of one copy is a diff against the other.
1126
+ * (2) has no bundler and cannot import anything, which is why the chain lives in a
1127
+ * file that is plain ES5 rather than in a .ts: the region between the BEGIN and END
1128
+ * markers is COPIED VERBATIM. Keep it ES5, dependency-free, `hz`-prefixed (it is
1129
+ * spliced into other people's scopes) and unformatted a reformat here is a diff
1130
+ * against the vendored copy. After editing, resync the door:
1131
+ *
1132
+ * curl -fsSL https://unpkg.com/@hanzo/event/src/anon.js -o apps/analytics/anon.js
1133
1133
  */
1134
1134
 
1135
1135
  Object.defineProperty(exports, "EVENTS", {