@iann29/rastro 0.5.0 → 0.7.0
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 +53 -9
- package/agent/integration.md +48 -19
- package/agent/manifest.json +13 -7
- package/agent/manifest.schema.json +18 -8
- package/dist/client/federation.d.ts +18 -8
- package/dist/client/federation.d.ts.map +1 -1
- package/dist/client/federation.js +7 -1
- package/dist/client/federation.js.map +1 -1
- package/dist/client/identity.d.ts +11 -0
- package/dist/client/identity.d.ts.map +1 -0
- package/dist/client/identity.js +123 -0
- package/dist/client/identity.js.map +1 -0
- package/dist/client/index.d.ts +257 -7
- package/dist/client/index.d.ts.map +1 -1
- package/dist/client/index.js +110 -4
- package/dist/client/index.js.map +1 -1
- package/dist/component/_generated/api.d.ts +2 -0
- package/dist/component/_generated/api.d.ts.map +1 -1
- package/dist/component/_generated/api.js.map +1 -1
- package/dist/component/_generated/component.d.ts +92 -0
- package/dist/component/_generated/component.d.ts.map +1 -1
- package/dist/component/ingest.d.ts.map +1 -1
- package/dist/component/ingest.js +37 -24
- package/dist/component/ingest.js.map +1 -1
- package/dist/component/people.d.ts +79 -0
- package/dist/component/people.d.ts.map +1 -0
- package/dist/component/people.js +249 -0
- package/dist/component/people.js.map +1 -0
- package/dist/component/reports.d.ts +13 -4
- package/dist/component/reports.d.ts.map +1 -1
- package/dist/component/reports.js +25 -10
- package/dist/component/reports.js.map +1 -1
- package/dist/component/sanitize.d.ts +3 -1
- package/dist/component/sanitize.d.ts.map +1 -1
- package/dist/component/sanitize.js +30 -1
- package/dist/component/sanitize.js.map +1 -1
- package/dist/component/schema.d.ts +42 -1
- package/dist/component/schema.js +30 -1
- package/dist/component/schema.js.map +1 -1
- package/dist/component/sites.d.ts +4 -0
- package/dist/component/sites.d.ts.map +1 -1
- package/dist/component/sites.js +13 -2
- package/dist/component/sites.js.map +1 -1
- package/dist/component/validators.d.ts +53 -1
- package/dist/component/validators.d.ts.map +1 -1
- package/dist/component/validators.js +28 -0
- package/dist/component/validators.js.map +1 -1
- package/dist/component/visitors.d.ts +38 -2
- package/dist/component/visitors.d.ts.map +1 -1
- package/dist/component/visitors.js +162 -42
- package/dist/component/visitors.js.map +1 -1
- package/dist/react/index.d.ts +9 -5
- package/dist/react/index.d.ts.map +1 -1
- package/dist/react/index.js +36 -5
- package/dist/react/index.js.map +1 -1
- package/dist/tracker/generated.d.ts +6 -6
- package/dist/tracker/generated.d.ts.map +1 -1
- package/dist/tracker/generated.js +6 -6
- package/dist/tracker/generated.js.map +1 -1
- package/dist/tracker/tracker.d.ts +2 -1
- package/dist/tracker/tracker.d.ts.map +1 -1
- package/dist/tracker/tracker.js +41 -2
- package/dist/tracker/tracker.js.map +1 -1
- package/dist/tracker.min.js +1 -1
- package/docs/federation.md +24 -0
- package/docs/identity.md +307 -0
- package/docs/upgrading.md +85 -20
- package/llms.txt +6 -2
- package/package.json +5 -3
- package/src/component/_generated/api.ts +2 -0
- package/src/component/_generated/component.ts +104 -0
- package/src/component/ingest.ts +54 -30
- package/src/component/people.ts +321 -0
- package/src/component/reports.ts +34 -9
- package/src/component/sanitize.ts +46 -1
- package/src/component/schema.ts +35 -0
- package/src/component/sites.ts +14 -1
- package/src/component/validators.ts +50 -0
- package/src/component/visitors.ts +232 -55
- package/src/tracker/generated.ts +6 -6
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tracker.js","sourceRoot":"","sources":["../../src/tracker/tracker.ts"],"names":[],"mappings":";
|
|
1
|
+
{"version":3,"file":"tracker.js","sourceRoot":"","sources":["../../src/tracker/tracker.ts"],"names":[],"mappings":";AA4CA,CAAC,GAAG,EAAE;IACJ,MAAM,MAAM,GAAG,QAAQ,CAAC,aAAyC,CAAC;IAClE,MAAM,MAAM,GAAG,MAAM,EAAE,OAAO,CAAC,IAAI,CAAC;IACpC,MAAM,QAAQ,GACZ,MAAM,EAAE,OAAO,CAAC,QAAQ;QACxB,CAAC,MAAM,EAAE,GAAG,IAA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,IAAI,GAAG,GAAG,EAAE;QAChB,IAAI,CAAC,UAAU,EAAE,CAAC;YAChB,IAAI,EAAE,CAAC;YACP,UAAU,GAAG,WAAW,CAAC,IAAI,EAAE,MAAM,CAAC,CAAC;QACzC,CAAC;IACH,CAAC,CAAC;IACF,MAAM,MAAM,GAAG,GAAG,EAAE;QAClB,IAAI,QAAQ,CAAC,MAAM;YAAE,IAAI,EAAE,CAAC;;YACvB,IAAI,EAAE,CAAC;IACd,CAAC,CAAC;IACF,gBAAgB,CAAC,UAAU,EAAE,IAAI,CAAC,CAAC;IACnC,0EAA0E;IAC1E,0EAA0E;IAC1E,yCAAyC;IACzC,gBAAgB,CAAC,UAAU,EAAE,MAAM,CAAC,CAAC;IACrC,QAAQ,CAAC,gBAAgB,CAAC,kBAAkB,EAAE,MAAM,CAAC,CAAC;IACtD,UAAU,GAAG,WAAW,CAAC,IAAI,EAAE,MAAM,CAAC,CAAC;IACvC,QAAQ,EAAE,CAAC;IACX,sEAAsE;IACtE,MAAM,EAAE,CAAC;AACX,CAAC,CAAC,EAAE,CAAC"}
|
package/dist/tracker.min.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
(()=>{const t=document.currentScript,e=t?.dataset.site,i=t?.dataset.endpoint||t?.src&&new URL("events",t.src).href;if(!e||!i)return;const n=()=>crypto.randomUUID?.()||Math.random()+"",
|
|
1
|
+
(()=>{const t=document.currentScript,e=t?.dataset.site,i=t?.dataset.endpoint||t?.src&&new URL("events",t.src).href;if(!e||!i)return;const n=()=>crypto.randomUUID?.()||Math.random()+"",r=new URLSearchParams(location.search),s=r.get("ref")?.slice(0,64);let o;for(const t of["source","medium","campaign","term","content"]){const e=r.get("utm_"+t)?.slice(0,64);e&&((o??={})["utm_"+t]=e)}const a="gclid gbraid wbraid msclkid ttclid twclid li_fat_id ScCid rdt_cid dclid epik srsltid mc_cid mc_eid _hsenc igsh igshid fbclid".split(" ").filter(t=>r.has(t)).slice(0,8);let c,d,l,h,f=t.dataset.visitor||"",p=Boolean(f);try{f||=localStorage._rv||=n()}catch{}try{d=sessionStorage,l=d._r,c=d._ri==f&&d._rt,h=s||d._a,h&&(d._a=h),o||=d._u&&JSON.parse(d._u),o&&(d._u=JSON.stringify(o))}catch{h=s}let v,g=0;const u=[];let m=document.referrer.split("/",3).join("/")||void 0;const _=t=>{const n=u.splice(0,50);if(!n.length)return;const r=()=>new Blob([JSON.stringify({siteId:e,events:n,sentAt:Date.now()})]);let s=r();for(;s.size>64e3&&n.length>1;)u.unshift(n.pop()),s=r();t&&navigator.sendBeacon(i,s)||fetch(i,{method:"POST",body:s,keepalive:1}).catch(()=>{}),u.length&&_(t)},y=(t,e,i)=>{const r=Date.now(),s=r-c;c=r,s<18e5||(l=n(),"pageview"!=t&&(S="",w()));try{d._r=l,d._ri=f,d._rt=r}catch{}u.push({eventId:`${l}.${r.toString(36)}.${g}`,sessionId:l,visitorId:f||l,type:t,name:e,path:location.pathname.slice(0,256),referrer:m,timestamp:r,sequence:g++,affiliateSlug:h,...i}),clearTimeout(v),v=setTimeout(_,1200)};let S;const w=()=>{const t=location.pathname;t!=S&&(S=t,y("pageview",void 0,{properties:o,clid:a.length?a:void 0}))};window.rastro=(e,i,r)=>{if("context"==e)return{sessionId:l,visitorId:f||l,identified:p};if("identify"==e||"reset"==e){if("identify"==e&&(!i||i.length>128||!/^[A-Za-z0-9][A-Za-z0-9_.:-]*$/.test(i)))return;if("identify"==e&&i==f)return;_();const r="reset"==e||p;if(p="identify"==e,f="identify"==e?i:n(),t.dataset.visitor="identify"==e?f:"",r){h=void 0,o=void 0,m=void 0,a.length=0;try{"reset"==e&&(localStorage._rv=f),d._a="",d._u=""}catch{}}c=0,g=0,S="",w()}"event"==e&&y("custom",`${i||"event"}`.slice(0,80),r&&JSON.stringify(r).length>2e4?void 0:{properties:r})},document.addEventListener("click",t=>{const e=t.target?.closest("a,button,[data-rastro-event]");if(!e)return;const i=e.dataset.rastroEvent,n=e.href,r=n&&new URL(n),s=/^https?:$/.test(r?.protocol),o=s&&r.origin!=location.origin;y(i?"custom":o?"outbound":"click",i,{target:(e.dataset.rastroLabel||e.innerText||e.tagName).slice(0,64),href:s?((o?r.origin:"")+r.pathname).slice(0,256):void 0})},1);for(const t of["pushState","replaceState"]){const e=history[t];history[t]=(...t)=>{e.apply(history,t),w()}}addEventListener("popstate",w);let b=0;const I=()=>{y("heartbeat"),_()},L=()=>{b&&(clearInterval(b),b=0,y("leave"),_(1))},E=()=>{document.hidden?L():b||(I(),b=setInterval(I,2e4))};addEventListener("pagehide",L),addEventListener("pageshow",E),document.addEventListener("visibilitychange",E),b=setInterval(I,2e4),w(),E()})();
|
package/docs/federation.md
CHANGED
|
@@ -291,6 +291,8 @@ export const {
|
|
|
291
291
|
overview,
|
|
292
292
|
liveVisitors,
|
|
293
293
|
getSession,
|
|
294
|
+
getVisitorProfile,
|
|
295
|
+
listPeople,
|
|
294
296
|
revenueSummary,
|
|
295
297
|
listSessions,
|
|
296
298
|
sessionJourney,
|
|
@@ -405,3 +407,25 @@ plane write. The customer operator provisions the authoritative grant through an
|
|
|
405
407
|
internal or host-admin mutation. For immediate revocation, revoke that local
|
|
406
408
|
grant before revoking the central connection; otherwise an already-issued token
|
|
407
409
|
remains valid until its ten-minute expiry.
|
|
410
|
+
|
|
411
|
+
## Identified visitor profiles
|
|
412
|
+
|
|
413
|
+
The optional `visitorProfiles` capability adds
|
|
414
|
+
`getVisitorProfile({siteId, visitorId})`. It resolves pre-login aliases and
|
|
415
|
+
returns `{visitorId, name?, email?, attributes?, identifiedAt, updatedAt}` or
|
|
416
|
+
null. `liveVisitors`, `listSessions` and `getSession` include an optional
|
|
417
|
+
`profile` for identified people. These attributes require `analytics:read`;
|
|
418
|
+
public live rows remove `profile`, and public tokens cannot call
|
|
419
|
+
`getVisitorProfile`. Older hosts work without this capability. Profile writes
|
|
420
|
+
stay in the product backend, outside federation. See
|
|
421
|
+
[identity integration](identity.md) for Better Auth, custom auth and external
|
|
422
|
+
servers.
|
|
423
|
+
|
|
424
|
+
The optional `people` capability adds
|
|
425
|
+
`listPeople({siteId, filter?, paginationOpts})`: a directory of current
|
|
426
|
+
profiles, independent of the report period. It supports a name/email/ID prefix
|
|
427
|
+
or an exact typed attribute value, with up to 50 rows per page. Cursors belong
|
|
428
|
+
to one site and filter. This query requires `analytics:read`; public tokens
|
|
429
|
+
cannot list people. Profile writes and the bounded `backfillVisitorProfiles`
|
|
430
|
+
upgrade remain host-authorized operations outside federation. See
|
|
431
|
+
[the directory contract and upgrade steps](identity.md#project-defined-attributes-and-the-people-directory).
|
package/docs/identity.md
ADDED
|
@@ -0,0 +1,307 @@
|
|
|
1
|
+
# Identify people with any authentication
|
|
2
|
+
|
|
3
|
+
Available in `@iann29/rastro@0.6.0` and later. Upgrade and deploy the host
|
|
4
|
+
before using these APIs in the browser or enabling the directory in federation.
|
|
5
|
+
|
|
6
|
+
Rastro connects a person's name and email to their visits, actions and
|
|
7
|
+
conversions. The product's backend resolves the signed-in user; Rastro does not
|
|
8
|
+
require Better Auth or a particular auth provider. Profiles and events stay in
|
|
9
|
+
the product's Rastro component.
|
|
10
|
+
|
|
11
|
+
## Shared contract
|
|
12
|
+
|
|
13
|
+
```ts
|
|
14
|
+
const profile = await analytics.identifyVisitor(ctx, {
|
|
15
|
+
siteId,
|
|
16
|
+
visitorId: user.analyticsId,
|
|
17
|
+
previousVisitorId, // optional: the browser's pre-login visitor ID
|
|
18
|
+
name: user.name,
|
|
19
|
+
email: user.email,
|
|
20
|
+
});
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
This is a trusted server call. Resolve `user` and authorize `siteId` on the
|
|
24
|
+
server. The result is `{ visitorId, name?, email?, identifiedAt, updatedAt }`.
|
|
25
|
+
Use the returned `visitorId` in the tracker. A repeated call is idempotent;
|
|
26
|
+
omitted attributes keep their values, and `name: null` or `email: null` removes
|
|
27
|
+
that attribute. Names are bounded to 160 characters and emails to 320.
|
|
28
|
+
|
|
29
|
+
Choose one stable ID per product user. Existing tracker IDs can be reused
|
|
30
|
+
unchanged. `visitorIdForUser(userId)` converts arbitrary provider IDs into a
|
|
31
|
+
stable tracker-compatible ID. Use your product's user primary key when auth
|
|
32
|
+
providers can change. With raw Convex JWT identities, use the complete
|
|
33
|
+
`tokenIdentifier`, which includes the issuer, rather than `subject` alone. Do
|
|
34
|
+
not use email as the identity key: it can change or be shared.
|
|
35
|
+
|
|
36
|
+
## Project-defined attributes and the people directory
|
|
37
|
+
|
|
38
|
+
No user table, workspace model, auth provider or business field is required.
|
|
39
|
+
Keep your product's existing user key and map its current attributes on the
|
|
40
|
+
server, in the same resolver used above:
|
|
41
|
+
|
|
42
|
+
```ts
|
|
43
|
+
return {
|
|
44
|
+
siteId: authorizedSiteId,
|
|
45
|
+
visitorId: user.analyticsId,
|
|
46
|
+
name: user.name,
|
|
47
|
+
email: user.email,
|
|
48
|
+
attributes: { language: "pt-BR", level: 3, enrolled: true },
|
|
49
|
+
};
|
|
50
|
+
```
|
|
51
|
+
|
|
52
|
+
An education app may send `level` and `enrolled`; a marketplace may send
|
|
53
|
+
`seller` and `orders`; a SaaS may send `plan` and `seats`. These are examples,
|
|
54
|
+
not built-in columns. Attribute values are strings, finite numbers or booleans.
|
|
55
|
+
Dates can be ISO strings. Attributes describe current state; put historical
|
|
56
|
+
context on the event's existing `properties` instead. Nested objects and arrays
|
|
57
|
+
are not supported in this first version.
|
|
58
|
+
|
|
59
|
+
Updates merge keys. Omitted keys are preserved; a null value deletes one key:
|
|
60
|
+
`attributes: { level: 4, enrolled: null }`. Empty strings, zero and false are
|
|
61
|
+
valid values. Each profile allows 32 keys, keys of up to 64 ASCII characters
|
|
62
|
+
starting with a letter (`A-Z`, `a-z`, digits, `.`, `_`, `-`), strings up to 512
|
|
63
|
+
characters, and at most 4096 UTF-8 bytes for the complete attribute map. Invalid
|
|
64
|
+
updates fail atomically. These limits also bound read and index costs.
|
|
65
|
+
|
|
66
|
+
```ts
|
|
67
|
+
const page = await analytics.listPeople(ctx, {
|
|
68
|
+
siteId: authorizedSiteId,
|
|
69
|
+
filter: { field: "attribute", key: "level", value: 3 },
|
|
70
|
+
paginationOpts: { cursor: null, numItems: 25 },
|
|
71
|
+
});
|
|
72
|
+
// page: { page: Person[], isDone, continueCursor }
|
|
73
|
+
```
|
|
74
|
+
|
|
75
|
+
The optional filter is either one exact typed attribute match, or a prefix:
|
|
76
|
+
`{ field: "name" | "email" | "visitorId", prefix: "Maria" }`. Names and emails
|
|
77
|
+
use case-insensitive Unicode-normalized prefixes; IDs preserve case. Text `"3"`
|
|
78
|
+
differs from number `3`. Each page uses the site's database indexes. Pages allow
|
|
79
|
+
1–50 people; pass `continueCursor` back as the next cursor. Cursors are scoped
|
|
80
|
+
to the site and filter. Clear the cursor when either changes. The directory
|
|
81
|
+
includes all identified profiles, independently of the dashboard's event date
|
|
82
|
+
range.
|
|
83
|
+
|
|
84
|
+
Re-export `listPeople` from `exposeFederatedAnalyticsApi` alongside
|
|
85
|
+
`getVisitorProfile`. The optional `people` capability enables the **Pessoas**
|
|
86
|
+
dashboard view. Existing hosts stay connected without it. People and attributes
|
|
87
|
+
are available only to authorized readers of that site; public links cannot list
|
|
88
|
+
them. The local `exposeAnalyticsApi` authorizer receives `visitor.list`.
|
|
89
|
+
|
|
90
|
+
For profiles created by the earlier unreleased identity implementation, call
|
|
91
|
+
`analytics.backfillVisitorProfiles(ctx, { siteId })` from a site-admin mutation
|
|
92
|
+
or action after deployment. Each call updates at most 64 profiles and returns
|
|
93
|
+
`{ updated, isDone }`; schedule another bounded call if `isDone` is false. The
|
|
94
|
+
local API wrapper uses the `visitor.index` authorization operation; it is not
|
|
95
|
+
exposed through federation. The example `analytics.ts` exports an
|
|
96
|
+
owner-authorized wrapper. Backfill preserves identity timestamps and is safe to
|
|
97
|
+
retry. Until it finishes, name/email search refuses to return partial results;
|
|
98
|
+
unfiltered and ID listings remain available. Fresh installations need no
|
|
99
|
+
backfill.
|
|
100
|
+
|
|
101
|
+
## Funnels across identification
|
|
102
|
+
|
|
103
|
+
Funnel progress resolves the canonical person and their pre-login aliases. Steps
|
|
104
|
+
recorded before login continue after login, including queued events under an
|
|
105
|
+
already-linked browser ID. Repeated identification and another tab do not start
|
|
106
|
+
another attempt inside the active conversion window. The original events and
|
|
107
|
+
their IDs stay intact. When multiple aliases already have progress, the furthest
|
|
108
|
+
attempt inside its conversion window takes precedence; expired attempts restart
|
|
109
|
+
only on the first step, as before.
|
|
110
|
+
|
|
111
|
+
Linking does not retroactively recompute already-counted funnel attempts or
|
|
112
|
+
other historical aggregates. Events must still arrive in step order; this change
|
|
113
|
+
does not add late-event replay.
|
|
114
|
+
|
|
115
|
+
## Convex with Better Auth
|
|
116
|
+
|
|
117
|
+
In the product's `convex/analyticsIdentity.ts`, use its existing auth component:
|
|
118
|
+
|
|
119
|
+
```ts
|
|
120
|
+
import { Rastro } from "@iann29/rastro";
|
|
121
|
+
import { components } from "./_generated/api";
|
|
122
|
+
import type { MutationCtx } from "./_generated/server";
|
|
123
|
+
import { authComponent } from "./auth";
|
|
124
|
+
|
|
125
|
+
const analytics = new Rastro(components.rastroAnalytics);
|
|
126
|
+
|
|
127
|
+
export const identifyVisitor = analytics.identifyVisitorMutation({
|
|
128
|
+
resolveUser: async (ctx: MutationCtx) => {
|
|
129
|
+
const user = await authComponent.safeGetAuthUser(ctx);
|
|
130
|
+
if (!user) return null;
|
|
131
|
+
return {
|
|
132
|
+
siteId: "YOUR_PRODUCT_SITE_ID",
|
|
133
|
+
visitorId: user._id,
|
|
134
|
+
name: user.name,
|
|
135
|
+
email: user.email,
|
|
136
|
+
};
|
|
137
|
+
},
|
|
138
|
+
});
|
|
139
|
+
```
|
|
140
|
+
|
|
141
|
+
`safeGetAuthUser` checks the Better Auth session. Rastro adds no Better Auth
|
|
142
|
+
runtime dependency. With multiple workspaces, resolve the site from the user's
|
|
143
|
+
authorized workspace in this callback instead of accepting a site from the
|
|
144
|
+
browser.
|
|
145
|
+
|
|
146
|
+
## Convex with custom auth or another JWT provider
|
|
147
|
+
|
|
148
|
+
Use the same mutation with your own user lookup:
|
|
149
|
+
|
|
150
|
+
```ts
|
|
151
|
+
import { Rastro, visitorIdForUser } from "@iann29/rastro";
|
|
152
|
+
import { components } from "./_generated/api";
|
|
153
|
+
import type { MutationCtx } from "./_generated/server";
|
|
154
|
+
|
|
155
|
+
const analytics = new Rastro(components.rastroAnalytics);
|
|
156
|
+
|
|
157
|
+
export const identifyVisitor = analytics.identifyVisitorMutation({
|
|
158
|
+
resolveUser: async (ctx: MutationCtx) => {
|
|
159
|
+
const identity = await ctx.auth.getUserIdentity();
|
|
160
|
+
if (!identity) return null;
|
|
161
|
+
return {
|
|
162
|
+
siteId: "YOUR_PRODUCT_SITE_ID",
|
|
163
|
+
visitorId: await visitorIdForUser(identity.tokenIdentifier),
|
|
164
|
+
name: identity.name,
|
|
165
|
+
email: identity.email,
|
|
166
|
+
};
|
|
167
|
+
},
|
|
168
|
+
});
|
|
169
|
+
```
|
|
170
|
+
|
|
171
|
+
For custom database-backed sessions, replace the resolver body with the
|
|
172
|
+
product's existing authenticated-user lookup. Returning `null` refuses the
|
|
173
|
+
request. The public mutation accepts only `previousVisitorId`; user ID, name,
|
|
174
|
+
email and site scope come from the resolver.
|
|
175
|
+
|
|
176
|
+
## React and browser lifecycle
|
|
177
|
+
|
|
178
|
+
After the login has established the backend session:
|
|
179
|
+
|
|
180
|
+
```tsx
|
|
181
|
+
const identifyVisitor = useMutation(api.analyticsIdentity.identifyVisitor);
|
|
182
|
+
const rastro = useRastro();
|
|
183
|
+
|
|
184
|
+
async function identifyAfterLogin() {
|
|
185
|
+
const before = rastro.context();
|
|
186
|
+
const profile = await identifyVisitor({
|
|
187
|
+
previousVisitorId:
|
|
188
|
+
before && !before.identified ? before.visitorId : undefined,
|
|
189
|
+
});
|
|
190
|
+
rastro.identify(profile.visitorId);
|
|
191
|
+
// Keep this ID in your auth state and pass it to RastroScript on later loads.
|
|
192
|
+
}
|
|
193
|
+
|
|
194
|
+
async function signOut() {
|
|
195
|
+
await yourAuth.signOut();
|
|
196
|
+
rastro.reset();
|
|
197
|
+
}
|
|
198
|
+
```
|
|
199
|
+
|
|
200
|
+
Import `useRastro` and `RastroScript` from `@iann29/rastro/react`; use your
|
|
201
|
+
app's existing `useMutation` from `convex/react`. Call identification again
|
|
202
|
+
after restoring a logged-in session. Discard a pending identification response
|
|
203
|
+
if the auth session has changed before it returns.
|
|
204
|
+
|
|
205
|
+
`<RastroScript visitorId={analyticsVisitorId} ... />` also synchronizes ID
|
|
206
|
+
changes and logout (`visitorId` becoming undefined), including a delayed script
|
|
207
|
+
load. Mount one tracker per page. Prefer one lifecycle owner: either the prop or
|
|
208
|
+
the explicit commands, so a logout does not reset twice.
|
|
209
|
+
|
|
210
|
+
For another frontend framework, use the equivalent commands:
|
|
211
|
+
|
|
212
|
+
```js
|
|
213
|
+
const before = window.rastro?.("context");
|
|
214
|
+
// Authenticate with your product backend, then obtain its Rastro profile.
|
|
215
|
+
window.rastro?.("identify", profile.visitorId);
|
|
216
|
+
// After logout:
|
|
217
|
+
window.rastro?.("reset");
|
|
218
|
+
```
|
|
219
|
+
|
|
220
|
+
`context` returns `{ visitorId, sessionId, identified }`. The browser commands
|
|
221
|
+
change the tracker ID, not the stored profile. Identification flushes queued
|
|
222
|
+
events under their original ID and opens a new session without a page reload.
|
|
223
|
+
The first login retains acquisition context. Logout creates a new browser
|
|
224
|
+
visitor; logout and direct account switches clear the previous person's
|
|
225
|
+
campaign/referral context. `identify` and `reset` from `useRastro` return false
|
|
226
|
+
when the deferred tracker is not ready; the `visitorId` prop handles that case.
|
|
227
|
+
|
|
228
|
+
## Other backends: authenticated HTTP
|
|
229
|
+
|
|
230
|
+
Mount an HTTP action on the Convex deployment that owns the Rastro component.
|
|
231
|
+
The external backend can be Node, Python, Go, Rails, or any HTTP client. The
|
|
232
|
+
analytics storage still runs on Convex or Synapse.
|
|
233
|
+
|
|
234
|
+
```ts
|
|
235
|
+
// convex/http.ts — merge into the product's existing router.
|
|
236
|
+
http.route({
|
|
237
|
+
path: "/analytics/identify",
|
|
238
|
+
method: "POST",
|
|
239
|
+
handler: analytics.identifyVisitorHttpAction({
|
|
240
|
+
authorize: async (_ctx, request, siteId) => {
|
|
241
|
+
const key = env.RASTRO_IDENTITY_SERVER_KEY;
|
|
242
|
+
if (
|
|
243
|
+
!key ||
|
|
244
|
+
request.headers.get("authorization") !== `Bearer ${key}` ||
|
|
245
|
+
siteId !== env.RASTRO_IDENTITY_SITE_ID
|
|
246
|
+
) {
|
|
247
|
+
throw new Error("Not authorized");
|
|
248
|
+
}
|
|
249
|
+
},
|
|
250
|
+
}),
|
|
251
|
+
});
|
|
252
|
+
```
|
|
253
|
+
|
|
254
|
+
Declare the two optional string env vars in `convex/convex.config.ts`. The
|
|
255
|
+
complete router and declarations are in `example/convex/`. Provision a random
|
|
256
|
+
server key and share it only with the authorized backend. If multiple backends
|
|
257
|
+
or sites are served, the authorizer must resolve each credential's site scope.
|
|
258
|
+
Do not expose the key in `VITE_`, `NEXT_PUBLIC_`, or browser code.
|
|
259
|
+
|
|
260
|
+
The external backend first authenticates its own user, then sends:
|
|
261
|
+
|
|
262
|
+
```ts
|
|
263
|
+
const response = await fetch(process.env.RASTRO_IDENTITY_URL!, {
|
|
264
|
+
method: "POST",
|
|
265
|
+
headers: {
|
|
266
|
+
"Content-Type": "application/json",
|
|
267
|
+
Authorization: `Bearer ${process.env.RASTRO_IDENTITY_SERVER_KEY}`,
|
|
268
|
+
},
|
|
269
|
+
body: JSON.stringify({
|
|
270
|
+
siteId: process.env.RASTRO_IDENTITY_SITE_ID,
|
|
271
|
+
visitorId: user.analyticsId,
|
|
272
|
+
previousVisitorId,
|
|
273
|
+
name: user.name,
|
|
274
|
+
email: user.email,
|
|
275
|
+
}),
|
|
276
|
+
});
|
|
277
|
+
if (!response.ok) throw new Error(`Rastro identify failed: ${response.status}`);
|
|
278
|
+
const profile = await response.json();
|
|
279
|
+
// Return profile.visitorId to the authenticated browser.
|
|
280
|
+
```
|
|
281
|
+
|
|
282
|
+
The endpoint accepts at most 8 KiB of JSON, validates the same fields as the SDK
|
|
283
|
+
and sends `Cache-Control: no-store`. Statuses: 200 success, 400 invalid input,
|
|
284
|
+
403 denied credential/site, 404 unknown site, 409 conflicting identity, 413
|
|
285
|
+
oversized body, 415 wrong content type, 429 alias limit, 500 server failure.
|
|
286
|
+
|
|
287
|
+
## Dashboard and existing history
|
|
288
|
+
|
|
289
|
+
Re-export `getVisitorProfile` from `exposeFederatedAnalyticsApi` in the host's
|
|
290
|
+
`convex/rastroFederation.ts`. It is advertised by the optional `visitorProfiles`
|
|
291
|
+
capability. Private live/session reports include a profile when one exists; old
|
|
292
|
+
hosts and unidentified visitors continue to work without it.
|
|
293
|
+
|
|
294
|
+
The dashboard shows names/emails in **Ao vivo** and **Jornadas**, searches those
|
|
295
|
+
attributes within the loaded session records, and opens the person's history for
|
|
296
|
+
the selected site and period. Existing events retain their original ID; the
|
|
297
|
+
identity link resolves them at read time. A profile is keyed by site and
|
|
298
|
+
visitor, with no email-based merging. An identified person cannot be linked into
|
|
299
|
+
another person. Each identity supports the existing limit of ten pre-login
|
|
300
|
+
aliases. Profile attributes persist independently of event retention and can be
|
|
301
|
+
cleared with explicit null updates.
|
|
302
|
+
|
|
303
|
+
Profile reads require a reader's authorization for that site. Public dashboard
|
|
304
|
+
links omit profiles and cannot call `getVisitorProfile`. The tracking endpoint
|
|
305
|
+
continues to accept browser telemetry; an identity label does not turn
|
|
306
|
+
browser-sent events into authenticated business transactions. Record revenue
|
|
307
|
+
through the existing trusted `trackConversion` server API.
|
package/docs/upgrading.md
CHANGED
|
@@ -1,5 +1,69 @@
|
|
|
1
1
|
# Upgrading Amage Rastro
|
|
2
2
|
|
|
3
|
+
## Route patterns and the navigation canvas (0.7.0)
|
|
4
|
+
|
|
5
|
+
Install `@iann29/rastro@0.7.0` and deploy the consuming host. The site's
|
|
6
|
+
optional `routePatterns` field is additive; no table, index, event or session is
|
|
7
|
+
removed. Existing federation exports and grants continue to work. `siteSettings`
|
|
8
|
+
returns the current patterns, `updateSite` accepts them, and `siteMap` includes
|
|
9
|
+
patterns by site so the dashboard can place live visitors on the same grouped
|
|
10
|
+
routes.
|
|
11
|
+
|
|
12
|
+
Set patterns in the dashboard's site settings, or in an owner-authorized call:
|
|
13
|
+
|
|
14
|
+
```ts
|
|
15
|
+
await analytics.updateSite(ctx, { siteId, routePatterns: ["/pedido/:codigo"] });
|
|
16
|
+
```
|
|
17
|
+
|
|
18
|
+
Use complete paths with named `:parameters`, one pattern per line in the UI. The
|
|
19
|
+
first matching pattern wins; ordinary product slugs stay separate unless
|
|
20
|
+
explicitly matched. At most 32 patterns, 256 characters each. Clearing the list
|
|
21
|
+
restores the default numeric/UUID/hex normalization for new events.
|
|
22
|
+
|
|
23
|
+
Retained map rollups are grouped on read, including transitions and unique
|
|
24
|
+
visitor estimates. Future map rollups are grouped on ingestion too. Original
|
|
25
|
+
URLs remain in journeys; already grouped map rollups cannot later be split, and
|
|
26
|
+
expired or previously capped data is not recovered. No backfill is needed. The
|
|
27
|
+
dashboard disables pattern editing for older hosts until their package is
|
|
28
|
+
updated. The separate canvas release works with their existing map responses.
|
|
29
|
+
|
|
30
|
+
## People, attributes and identity continuity (0.6.0)
|
|
31
|
+
|
|
32
|
+
Install `@iann29/rastro@0.6.0` and deploy the host through its normal workflow.
|
|
33
|
+
|
|
34
|
+
- Additive `visitorProfiles` and `visitorAttributes` storage; no event/session
|
|
35
|
+
rewrite.
|
|
36
|
+
- Attributes are optional project-defined strings, numbers and booleans. Name,
|
|
37
|
+
email and attribute searches use indexes with bounded pagination.
|
|
38
|
+
- `identifyVisitor`, `identifyVisitorMutation` and authenticated
|
|
39
|
+
`identifyVisitorHttpAction` support any backend authentication. Existing
|
|
40
|
+
`linkVisitor` remains available.
|
|
41
|
+
- Re-export `getVisitorProfile` and `listPeople` from federation and refresh the
|
|
42
|
+
connection to advertise `visitorProfiles` and `people`. The dashboard
|
|
43
|
+
tolerates older hosts. Its Pessoas view lists profiles, filters attributes and
|
|
44
|
+
opens history.
|
|
45
|
+
- For profiles created before the directory, call the owner-authorized
|
|
46
|
+
`backfillVisitorProfiles({siteId})` until `isDone` is true (at most 64
|
|
47
|
+
profiles per call). This initializes search fields and attribute indexes;
|
|
48
|
+
timestamps and event history are preserved. Fresh installations need no
|
|
49
|
+
backfill.
|
|
50
|
+
- Funnels continue across linked pre-login and account IDs, including queued
|
|
51
|
+
alias events. Historical aggregates are not recomputed; steps must still
|
|
52
|
+
arrive in order.
|
|
53
|
+
- Map connections between routes in the same column bend around intermediate
|
|
54
|
+
nodes instead of drawing through them.
|
|
55
|
+
- Tracker `identify`/`reset` rotate sessions on login/logout without a reload;
|
|
56
|
+
`context` now includes `identified`. `RastroScript` synchronizes identity
|
|
57
|
+
changes and forwards native load/error events.
|
|
58
|
+
- The reference example's auth entrypoint is now
|
|
59
|
+
`analyticsIdentity:identifyVisitor`; configure its server-owned
|
|
60
|
+
`RASTRO_IDENTITY_SITE_ID`. Its optional HTTP route also requires
|
|
61
|
+
`RASTRO_IDENTITY_SERVER_KEY`.
|
|
62
|
+
- The tracker budget is now below 1,700 bytes gzip including identity switching.
|
|
63
|
+
|
|
64
|
+
See [the complete identity guide](identity.md) for integration and deployment
|
|
65
|
+
order.
|
|
66
|
+
|
|
3
67
|
Pin exact versions, read the changelog, and rehearse upgrades against a
|
|
4
68
|
non-production snapshot before changing a maintained deployment. `0.1.0` is the
|
|
5
69
|
first release without a prerelease tag; the alphas below it stay documented for
|
|
@@ -7,26 +71,27 @@ hosts still on them.
|
|
|
7
71
|
|
|
8
72
|
## Release matrix
|
|
9
73
|
|
|
10
|
-
| Current state | Required path | Success condition
|
|
11
|
-
| ----------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
|
|
12
|
-
| Fresh deployment | Install the intended release directly | Component deploys and `/rastro/health` succeeds
|
|
13
|
-
| `0.1.0-alpha.0` with maintained data | Install `0.1.0-alpha.1` first and wait for staged visitor-index backfills | Every staged index reports complete before installing `alpha.2`
|
|
14
|
-
| `0.1.0-alpha.1` | Wait for staged visitor-index backfills, then install `alpha.2` | Backfills complete before active readers deploy
|
|
15
|
-
| `0.1.0-alpha.2` with legacy `events` rows | Stay on `alpha.2` and run/resume migration | Durable success plus empty source
|
|
16
|
-
| `0.1.0-alpha.3` fresh/canonical deployment | Rehearse the next alpha normally | Schema, reports, tracker, and retention checks pass
|
|
17
|
-
| `0.1.0-alpha.3` through `alpha.5` with canonical data | Install `0.1.0-alpha.6` directly; Web Vitals tables are additive | Schema deploys and `/rastro/health` reports `webVitals: "optIn"`
|
|
18
|
-
| `0.1.0-alpha.6` | Install `0.1.0-alpha.7` directly; no schema change | `GET /rastro/tracker.js` contains `sentAt`
|
|
19
|
-
| `0.1.0-alpha.7` | Install `0.1.0-alpha.8` directly; site map tables are additive; re-export `siteMap` | `/rastro/health` reports `siteMap: "dailyRollup"`
|
|
20
|
-
| `0.1.0-alpha.8` | Install `0.1.0-alpha.10` directly; no schema change; the tracker changes | `/rastro/health` reports `liveDepartures: "leaveBeacon"`
|
|
21
|
-
| `0.1.0-alpha.9` | Install `0.1.0-alpha.10` directly; `alpha.9` is deprecated — it rejected its own leave beacons | The final page-close `POST /rastro/events` returns 200
|
|
22
|
-
| `0.1.0-alpha.10` | Install `0.1.0-alpha.12` directly; new tables and fields are additive; re-export the configure functions to opt in | `/rastro/health` reports `tracker.version: "0.1.0-alpha.12"`
|
|
23
|
-
| `0.1.0-alpha.11` | Install `0.1.0-alpha.12` directly; same code, the package now ships `src/tracker/generated.ts` | A `convex/` test importing `@iann29/rastro/test` typechecks on push
|
|
24
|
-
| `0.1.0-alpha.12` | Install `0.1.0` directly; every schema change is an optional field or a new table; add `analytics:public` to a grant only to allow public links | `/rastro/health` reports `tracker.version: "0.1.0"`
|
|
25
|
-
| `0.1.0` | Install `0.2.0` directly; add the optional host callback and grant version to enable transfers | Health reports `0.2.0`; opted-in connectors advertise `transfer`
|
|
26
|
-
| `0.2.0` | Install `0.3.0` directly; no new table; export `getSession` and `revenueSummary` from the federation module | Health reports `0.3.0`; the manifest lists `sessionDetails`
|
|
27
|
-
| `0.3.0` | Install `0.4.0` directly; no re-export; the deploy rebuilds the `reportRollupQueue` index and the tracker changes | Health reports `0.4.0`; a hidden tab leaves **Ao vivo** in ~10 s
|
|
28
|
-
| `0.4.0` | Install `0.5.0` directly; every schema change is an optional field or a new table; export `listTrackedLinks`, `createTrackedLink`, `updateTrackedLink` and `deleteTrackedLink` from the federation module; reverify — the manifest advertises `trackedLinks` | Health reports `0.5.0`; the manifest lists `trackedLinks`
|
|
29
|
-
|
|
|
74
|
+
| Current state | Required path | Success condition |
|
|
75
|
+
| ----------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------- |
|
|
76
|
+
| Fresh deployment | Install the intended release directly | Component deploys and `/rastro/health` succeeds |
|
|
77
|
+
| `0.1.0-alpha.0` with maintained data | Install `0.1.0-alpha.1` first and wait for staged visitor-index backfills | Every staged index reports complete before installing `alpha.2` |
|
|
78
|
+
| `0.1.0-alpha.1` | Wait for staged visitor-index backfills, then install `alpha.2` | Backfills complete before active readers deploy |
|
|
79
|
+
| `0.1.0-alpha.2` with legacy `events` rows | Stay on `alpha.2` and run/resume migration | Durable success plus empty source |
|
|
80
|
+
| `0.1.0-alpha.3` fresh/canonical deployment | Rehearse the next alpha normally | Schema, reports, tracker, and retention checks pass |
|
|
81
|
+
| `0.1.0-alpha.3` through `alpha.5` with canonical data | Install `0.1.0-alpha.6` directly; Web Vitals tables are additive | Schema deploys and `/rastro/health` reports `webVitals: "optIn"` |
|
|
82
|
+
| `0.1.0-alpha.6` | Install `0.1.0-alpha.7` directly; no schema change | `GET /rastro/tracker.js` contains `sentAt` |
|
|
83
|
+
| `0.1.0-alpha.7` | Install `0.1.0-alpha.8` directly; site map tables are additive; re-export `siteMap` | `/rastro/health` reports `siteMap: "dailyRollup"` |
|
|
84
|
+
| `0.1.0-alpha.8` | Install `0.1.0-alpha.10` directly; no schema change; the tracker changes | `/rastro/health` reports `liveDepartures: "leaveBeacon"` |
|
|
85
|
+
| `0.1.0-alpha.9` | Install `0.1.0-alpha.10` directly; `alpha.9` is deprecated — it rejected its own leave beacons | The final page-close `POST /rastro/events` returns 200 |
|
|
86
|
+
| `0.1.0-alpha.10` | Install `0.1.0-alpha.12` directly; new tables and fields are additive; re-export the configure functions to opt in | `/rastro/health` reports `tracker.version: "0.1.0-alpha.12"` |
|
|
87
|
+
| `0.1.0-alpha.11` | Install `0.1.0-alpha.12` directly; same code, the package now ships `src/tracker/generated.ts` | A `convex/` test importing `@iann29/rastro/test` typechecks on push |
|
|
88
|
+
| `0.1.0-alpha.12` | Install `0.1.0` directly; every schema change is an optional field or a new table; add `analytics:public` to a grant only to allow public links | `/rastro/health` reports `tracker.version: "0.1.0"` |
|
|
89
|
+
| `0.1.0` | Install `0.2.0` directly; add the optional host callback and grant version to enable transfers | Health reports `0.2.0`; opted-in connectors advertise `transfer` |
|
|
90
|
+
| `0.2.0` | Install `0.3.0` directly; no new table; export `getSession` and `revenueSummary` from the federation module | Health reports `0.3.0`; the manifest lists `sessionDetails` |
|
|
91
|
+
| `0.3.0` | Install `0.4.0` directly; no re-export; the deploy rebuilds the `reportRollupQueue` index and the tracker changes | Health reports `0.4.0`; a hidden tab leaves **Ao vivo** in ~10 s |
|
|
92
|
+
| `0.4.0` | Install `0.5.0` directly; every schema change is an optional field or a new table; export `listTrackedLinks`, `createTrackedLink`, `updateTrackedLink` and `deleteTrackedLink` from the federation module; reverify — the manifest advertises `trackedLinks` | Health reports `0.5.0`; the manifest lists `trackedLinks` |
|
|
93
|
+
| `0.5.0` | Install `0.6.0`; export `listPeople` and `getVisitorProfile`, deploy, and reverify. Use the host identity resolver to populate profiles. | Health reports `0.6.0`; the manifest lists `people` and `visitorProfiles` |
|
|
94
|
+
| Any release whose packed declarations lack federation | Stop and request an eligible exact registry release | Packed declarations contain the federation exports |
|
|
30
95
|
|
|
31
96
|
Do not upgrade a populated legacy deployment directly to a release that removes
|
|
32
97
|
the `events` table. Schema acceptance alone does not prove that telemetry was
|
package/llms.txt
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# Amage Rastro
|
|
2
2
|
|
|
3
|
-
>
|
|
3
|
+
> Real-time product and web analytics: identified people, journeys, conversions and retention on Convex. Telemetry stays in each product's Convex or Synapse deployment; the central dashboard reads only an explicitly granted report surface, and configures a site only when its host's grant opts into the configure scope.
|
|
4
4
|
|
|
5
5
|
Canonical documentation: https://www.amagerastro.com/docs/
|
|
6
6
|
Machine manifest: https://www.amagerastro.com/agent/manifest.json
|
|
@@ -16,7 +16,7 @@ Do not infer federation availability from this website, a dist-tag, or a source
|
|
|
16
16
|
## Architecture
|
|
17
17
|
|
|
18
18
|
- Tracker and telemetry: browser -> customer HTTP-actions URL -> customer Rastro component.
|
|
19
|
-
- The tracker is 2,
|
|
19
|
+
- The tracker is 2,999 bytes raw and 1,565 gzip. It sends the click-ID key **names** of the landing URL in `clid` (`gclid`, `fbclid`, `ttclid`…), at most eight, never a value, and the referrer as scheme and host, so an `android-app://<package>` referrer keeps its package.
|
|
20
20
|
- Tracked links (0.5.0+): browser -> customer HTTP-actions URL `/rastro/l/<slug>` -> `302` (`Cache-Control: no-store`) to a destination on one of the site's domains, with `utm_source` (platform), `utm_medium` (channel), `utm_campaign` (campaign, or the slug) and `utm_content` (slug) appended; the destination's own query and `utm_*` keys stay. Unknown or disabled slug: `404`. Clicks count in four-shard daily counters; self-declared bots are redirected and counted apart.
|
|
21
21
|
- Optional field Web Vitals (alpha.6+): a second browser module at `/rastro/vitals.js` reports LCP, CLS, INP, FCP, and TTFB to the same events endpoint, into bounded daily histograms; it needs the base tracker on the page.
|
|
22
22
|
- Reactive dashboard reads: amagerastro.com browser -> customer functions URL -> `rastroFederation:*`.
|
|
@@ -76,3 +76,7 @@ Do not infer federation availability from this website, a dist-tag, or a source
|
|
|
76
76
|
- `dataCoverage` echoes the authorized site ID but returns no event, visitor, or session IDs.
|
|
77
77
|
- `vitalsReport` returns p75, averages, and exact good/needs-improvement/poor counts per metric, page, and device — never individual measurements.
|
|
78
78
|
- `siteMap` returns per-route totals (pageviews, estimated visitors, entries, derived exits and bounces, time on page) and route-to-route transition counts, with numeric, UUID, and long hexadecimal segments collapsed to `:id` — never sessions, visitor IDs, or query strings. `liveVisitors` adds `previousPath` and `movedAt` when a visitor moves between routes, and since 0.1.0 the intent facts of the session — `entryPath`, `returning`, `utmCampaign`, `affiliateSlug`, `conversionCount`, and the furthest `funnel` step — which `visitorHeat` from the package turns into the dashboard's hot/warm/cold score.
|
|
79
|
+
|
|
80
|
+
## People and identity (0.6.0+)
|
|
81
|
+
|
|
82
|
+
Use the [identity guide](https://www.amagerastro.com/docs/reference/identity.md) for Better Auth, custom Convex auth and authenticated HTTP from other backends. `Rastro.identifyVisitorMutation` resolves the current user on the host; `identifyVisitorHttpAction` authorizes external servers. `getVisitorProfile` requires reader access and is advertised as `visitorProfiles`. `listPeople` adds the optional `people` directory with indexed name/email/ID prefix search and exact filters on project-defined string, number or boolean attributes. Existing profiles need the bounded host-authorized search backfill described in the guide. The browser applies the returned ID with `identify` and calls `reset` on logout.
|
package/package.json
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@iann29/rastro",
|
|
3
|
-
"description": "
|
|
3
|
+
"description": "Real-time product and web analytics for Convex: identified people, journeys, revenue, goals, funnels, affiliates, and a lightweight browser tracker.",
|
|
4
4
|
"repository": "github:amageweb/amage-rastro",
|
|
5
5
|
"homepage": "https://github.com/amageweb/amage-rastro#readme",
|
|
6
6
|
"bugs": {
|
|
7
7
|
"url": "https://github.com/amageweb/amage-rastro/issues"
|
|
8
8
|
},
|
|
9
|
-
"version": "0.
|
|
9
|
+
"version": "0.7.0",
|
|
10
10
|
"license": "Apache-2.0",
|
|
11
11
|
"publishConfig": {
|
|
12
12
|
"access": "public"
|
|
@@ -16,7 +16,7 @@
|
|
|
16
16
|
"convex-component",
|
|
17
17
|
"analytics",
|
|
18
18
|
"realtime",
|
|
19
|
-
"
|
|
19
|
+
"product-analytics",
|
|
20
20
|
"cookieless",
|
|
21
21
|
"session-journey",
|
|
22
22
|
"conversion-tracking",
|
|
@@ -46,6 +46,7 @@
|
|
|
46
46
|
"typecheck": "tsc --noEmit && tsc -p control-plane && tsc -p control-plane/convex && tsc -p example/convex",
|
|
47
47
|
"lint": "eslint .",
|
|
48
48
|
"test": "vitest run --typecheck",
|
|
49
|
+
"test:layout": "playwright test -c control-plane/playwright.layout.config.ts",
|
|
49
50
|
"test:watch": "vitest --typecheck --clearScreen false",
|
|
50
51
|
"test:debug": "vitest --inspect-brk --no-file-parallelism",
|
|
51
52
|
"test:coverage": "vitest run --coverage --coverage.reporter=text",
|
|
@@ -68,6 +69,7 @@
|
|
|
68
69
|
"docs/federation.md",
|
|
69
70
|
"docs/federation-setup.md",
|
|
70
71
|
"docs/upgrading.md",
|
|
72
|
+
"docs/identity.md",
|
|
71
73
|
"docs/benchmarks/*.md",
|
|
72
74
|
"assets/rastro-live-atlas.png"
|
|
73
75
|
],
|
|
@@ -25,6 +25,7 @@ import type * as ingest from "../ingest.js";
|
|
|
25
25
|
import type * as live from "../live.js";
|
|
26
26
|
import type * as localTime from "../localTime.js";
|
|
27
27
|
import type * as origin from "../origin.js";
|
|
28
|
+
import type * as people from "../people.js";
|
|
28
29
|
import type * as platforms from "../platforms.js";
|
|
29
30
|
import type * as reports from "../reports.js";
|
|
30
31
|
import type * as retention from "../retention.js";
|
|
@@ -63,6 +64,7 @@ const fullApi: ApiFromModules<{
|
|
|
63
64
|
live: typeof live;
|
|
64
65
|
localTime: typeof localTime;
|
|
65
66
|
origin: typeof origin;
|
|
67
|
+
people: typeof people;
|
|
66
68
|
platforms: typeof platforms;
|
|
67
69
|
reports: typeof reports;
|
|
68
70
|
retention: typeof retention;
|