### GET /api/widget/seen Source: https://github.com/heydeacon/skills/blob/main/_autodocs/types.md Returns the latest sighting information for a site, including the answer to the founder's Install page, the newest sighting, refused addresses, and signed-in load information. Consumed by deacon-install verification. ```APIDOC ## [GET] /api/widget/seen ### Description Returns the latest sighting information for a site, including the answer to the founder's Install page, the newest sighting, refused addresses, and signed-in load information. Consumed by deacon-install verification. ### Method GET ### Endpoint /api/widget/seen ### Parameters #### Query Parameters - **k** (string) - Required - The site key. ### Response #### Success Response (200) - **seen** (Sighting | null) - The answer the founder's Install page asks — prefers a real deployment and keeps reporting it once one has been heard from. - **latest** (Sighting | null) - The newest sighting whatever its origin; the only field that moves when installing into a dev environment on a site that is already live. - **refused** (Sighting | null) - An address that was turned away because it is not on the list (a development address, or a listed site over another scheme or port); reported for up to a day; no `local`/`fresh` fields. - **signedIn** (Sighting | null) - Where and when a page last loaded Deacon with someone signed in; says whether, never who (no id, email or name); stays `null` until a signed-in load; moves at most once every ten minutes per address. #### Response Example { "seen": null, "latest": null, "refused": null, "signedIn": null } ``` -------------------------------- ### SeenResponse JSON body for GET /api/widget/seen Source: https://github.com/heydeacon/skills/blob/main/_autodocs/types.md Example response body for the GET /api/widget/seen endpoint. The seen field prefers a real deployment and keeps reporting it once heard from; latest is the newest sighting regardless of origin; refused is an address turned away (reported up to a day, no local/fresh fields); signedIn stays null until a signed-in load and moves at most once every ten minutes per address. Consumed by deacon-install verification via curl -s "https://heydeacon.com/api/widget/seen?k=SITE_KEY". ```json { "seen": null, "latest": null, "refused": null, "signedIn": null } ``` -------------------------------- ### Install Deacon Skills via Claude Code Source: https://github.com/heydeacon/skills/blob/main/_autodocs/configuration.md Adds the Deacon skills marketplace and installs the 'deacon' skill package in Claude Code. ```bash /plugin marketplace add heydeacon/skills /plugin install deacon@heydeacon ``` -------------------------------- ### Response with sighting data Source: https://github.com/heydeacon/skills/blob/main/_autodocs/endpoints.md Example response showing seen, latest, and signedIn populated. refused remains null. ```json {"seen": {"origin": "https://acme.com", "lastSeenAt": "2026-09-06T14:02:10+00:00", "local": false, "fresh": true}, "latest": {"origin": "http://localhost:3000", "lastSeenAt": "2026-09-08T09:14:22+00:00", "local": true}, "refused": null, "signedIn": {"origin": "http://localhost:3000", "lastSeenAt": "2026-09-08T09:14:22+00:00", "local": true}} ``` -------------------------------- ### Sightings response for a dev server on localhost not on the list Source: https://github.com/heydeacon/skills/blob/main/skills/deacon-install/SKILL.md Example JSON response when a dev server on localhost is not on the allowed list. `refused` names the address and when it was turned away, for up to a day. ```json {"seen": null, "latest": null, "refused": {"origin": "http://localhost:3000", "lastSeenAt": "2026-09-08T09:14:22+00:00"}, "signedIn": null} ``` -------------------------------- ### Sightings response after a page has loaded Source: https://github.com/heydeacon/skills/blob/main/skills/deacon-install/SKILL.md Example JSON response after a page has loaded the snippet. `seen` prefers a real deployment, `latest` is the newest sighting regardless of origin, and `signedIn` reports where and when a page last loaded Deacon with someone signed in. ```json {"seen": {"origin": "https://acme.com", "lastSeenAt": "2026-09-06T14:02:10+00:00", "local": false, "fresh": true}, "latest": {"origin": "http://localhost:3000", "lastSeenAt": "2026-09-08T09:14:22+00:00", "local": true}, "refused": null, "signedIn": {"origin": "http://localhost:3000", "lastSeenAt": "2026-09-08T09:14:22+00:00", "local": true, "verifiedAt": "2026-09-08T09:15:03+00:00", "failedAt": null, "failure": null}} ``` -------------------------------- ### Install Deacon skills with npx Source: https://github.com/heydeacon/skills/blob/main/README.md Use this command for other agents that read skills to add the Deacon skills. ```bash npx skills add heydeacon/skills ``` -------------------------------- ### Install Deacon skills in Claude Code Source: https://github.com/heydeacon/skills/blob/main/README.md Use these commands in Claude Code to add and install the Deacon skills from the marketplace. ```bash /plugin marketplace add heydeacon/skills /plugin install deacon@heydeacon ``` -------------------------------- ### Install Deacon Skills via npx Source: https://github.com/heydeacon/skills/blob/main/_autodocs/configuration.md Adds the Deacon skills to other agents that read skills using npx. ```bash npx skills add heydeacon/skills ``` -------------------------------- ### Response with refused sighting Source: https://github.com/heydeacon/skills/blob/main/_autodocs/endpoints.md Example response when a dev server on localhost is not on the allowed list. refused is populated, others null. ```json {"seen": null, "latest": null, "refused": {"origin": "http://localhost:3000", "lastSeenAt": "2026-09-08T09:14:22+00:00"}, "signedIn": null} ``` -------------------------------- ### Window.deaconUser Source: https://github.com/heydeacon/skills/blob/main/_autodocs/types.md The global that labels who is signed in; read once by the loader when it starts. It is an optional object with id, email, and name fields. ```APIDOC ## Window.deaconUser ### Description The global that labels who is signed in; read once by the loader when it starts. ### Type ```ts deaconUser?: { id?: string | number; email?: string; name?: string } | null; ``` ### Fields - **id** (string | number) - Optional - The app's id for the user - **email** (string) - Optional - The user's email - **name** (string) - Optional - The user's name ### Accepted By - `window.deaconUser` assignment - `Deacon.identify(user: { id?: string | number; email?: string; name?: string } | null): void` ``` -------------------------------- ### GoalsResponse JSON body for GET /api/goals/recent Source: https://github.com/heydeacon/skills/blob/main/_autodocs/types.md Example response body for the GET /api/goals/recent endpoint. The goals array lists GoalEvent objects (name, arrivedAt, from, named) newest first; waiting lists goal names that have not arrived yet. A name is listed from its first arrival and stays listed. Consumed by deacon-goals verification via curl -s "https://heydeacon.com/api/goals/recent?k=SITE_KEY". ```json { "goals": [ { "name": "Sign up", "arrivedAt": "2026-09-08T09:05:00+00:00", "from": "localhost", "named": true } ], "waiting": ["Upgraded"] } ``` -------------------------------- ### curl request to GET /api/widget/seen Source: https://github.com/heydeacon/skills/blob/main/_autodocs/endpoints.md Verification endpoint used by deacon-install. Takes the site's public widget key as the query parameter 'k'. No auth beyond possession of the key. ```bash curl -s "https://heydeacon.com/api/widget/seen?k=SITE_KEY" ``` -------------------------------- ### GET /api/goals/recent Source: https://github.com/heydeacon/skills/blob/main/_autodocs/types.md Returns the goals seen for a site, newest first, and the goals named on the dashboard that have not arrived yet. Consumed by deacon-goals verification. ```APIDOC ## [GET] /api/goals/recent ### Description Returns the goals seen for a site, newest first, and the goals named on the dashboard that have not arrived yet. Consumed by deacon-goals verification. ### Method GET ### Endpoint /api/goals/recent ### Parameters #### Query Parameters - **k** (string) - Required - The site key. ### Response #### Success Response (200) - **goals** (GoalEvent[]) - Goals seen for this site, newest first. - **waiting** (string[]) - The goals named on the dashboard that have not arrived yet. #### Response Example { "goals": [ { "name": "Sign up", "arrivedAt": "2026-09-08T09:05:00+00:00", "from": "localhost", "named": true } ], "waiting": ["Upgraded"] } ### GoalEvent Fields - **name** (string) - The goal's name. - **arrivedAt** (string) - ISO 8601 timestamp of first arrival. - **from** (string) - The sending origin (e.g. `localhost`). - **named** (boolean) - Whether the founder named that goal on the dashboard; `false` is expected for an agent-added goal, not a failure. ``` -------------------------------- ### GET /api/widget/seen Source: https://github.com/heydeacon/skills/blob/main/_autodocs/endpoints.md Verification endpoint used by deacon-install. Takes the site's public widget key as a query parameter and returns JSON with sighting information. ```APIDOC ## [GET] https://heydeacon.com/api/widget/seen ### Description Verification endpoint used by `deacon-install`. Takes the site's public widget key as the query parameter and returns JSON with sighting information. ### Method GET ### Endpoint https://heydeacon.com/api/widget/seen ### Parameters #### Query Parameters - **k** (string) - Required - The site's public widget key (`pk_...`), exactly the `data-key` value from the loader snippet. ### Request Example ``` curl -s "https://heydeacon.com/api/widget/seen?k=SITE_KEY" ``` ### Response #### Success Response (200) - **seen** (Sighting | null) - The founder's "are you live" answer; prefers a real deployment and keeps reporting it once one has been heard from. - **latest** (Sighting | null) - Newest sighting whatever its origin — the only one that moves when installing into a dev environment on a site already live. - **refused** (Sighting | null) - A development address, or a listed site over another scheme or port, turned away; reported for up to a day; no `local`/`fresh`. - **signedIn** (Sighting | null) - Newest sighting of a page loaded with someone signed in (via `window.deaconUser` or `Deacon.identify`); says whether, never who; moves at most once every ten minutes per address; a `data-no-page-views` page still counts. #### Response Example ```json {"seen": null, "latest": null, "refused": null, "signedIn": null} ``` ```json {"seen": {"origin": "https://acme.com", "lastSeenAt": "2026-09-06T14:02:10+00:00", "local": false, "fresh": true}, "latest": {"origin": "http://localhost:3000", "lastSeenAt": "2026-09-08T09:14:22+00:00", "local": true}, "refused": null, "signedIn": {"origin": "http://localhost:3000", "lastSeenAt": "2026-09-08T09:14:22+00:00", "local": true}} ``` ### Error Handling - Status codes are not documented in the source; the body is the JSON above. - Sighting rules: a sighting requires a real page load of the tag — "a sighting cannot be faked", and the config endpoint must not be called by hand to manufacture one. A site already running Deacon answers straight away with its own sighting, so the first (non-null) call is evidence of nothing the agent did; the waiting is for `latest` changing. - `refused` example (dev server on localhost not on the list): ```json {"seen": null, "latest": null, "refused": {"origin": "http://localhost:3000", "lastSeenAt": "2026-09-08T09:14:22+00:00"}, "signedIn": null} ``` ``` -------------------------------- ### Set deaconUser to null for signed-out page Source: https://github.com/heydeacon/skills/blob/main/_autodocs/api-reference/widget-api.md Renders window.deaconUser = null; where the layout knows nobody is signed in, so the next person on a shared computer starts fresh. ```html window.deaconUser = null; ``` -------------------------------- ### Window.Deacon merged interface declaration Source: https://github.com/heydeacon/skills/blob/main/_autodocs/types.md TypeScript declaration for the global Deacon interface, merged from two declare global blocks in the install and goals skills. The install skill says to merge when the goals declaration already exists. ```typescript Deacon?: { identify(user: { id?: string | number; email?: string; name?: string } | null): void; setContext(values: Record | null): void; track(name: string, props?: Record): void; } ``` -------------------------------- ### Window.deaconUser type declaration Source: https://github.com/heydeacon/skills/blob/main/_autodocs/types.md TypeScript declaration for the global that labels who is signed in. Read once by the loader when it starts. Accepted by the window.deaconUser assignment and passed to Deacon.identify. ```typescript deaconUser?: { id?: string | number; email?: string; name?: string } | null; ``` -------------------------------- ### Identify user and clear on sign-out Source: https://github.com/heydeacon/skills/blob/main/_autodocs/api-reference/widget-api.md Sets window.deaconUser and calls Deacon.identify() once the app knows who is signed in. On sign-out, clears the user and context so the next visitor starts fresh. The optional chaining prevents errors if the loader hasn't run yet. ```js // once the app knows who is signed in, including a session it restores on load window.deaconUser = { id: user.id, email: user.email, name: user.name }; window.Deacon?.identify(window.deaconUser); // on sign-out, so the next person on this computer starts fresh window.deaconUser = null; window.Deacon?.identify(null); window.Deacon?.setContext(null); ``` -------------------------------- ### curl request to GET /api/goals/recent Source: https://github.com/heydeacon/skills/blob/main/_autodocs/endpoints.md Verification endpoint used by deacon-goals and for agents to discover named goals. Requires the site's public widget key as the 'k' query parameter. Returns a JSON object with goals and waiting names. ```bash curl -s "https://heydeacon.com/api/goals/recent?k=SITE_KEY" ``` -------------------------------- ### GET /api/widget/seen Source: https://github.com/heydeacon/skills/blob/main/_autodocs/errors.md Polls widget seen state for a given site key. Use to verify whether the widget was displayed to the user. ```APIDOC ## [GET] /api/widget/seen ### Description Polls widget seen state for a given site key. Use to verify whether the widget was displayed to the user. ### Method GET ### Endpoint /api/widget/seen ### Parameters #### Query Parameters - **k** (string) - Required - Site key for the widget seen state. ### Response #### Success Response (200) - **recorded** (boolean) - Indicates whether the widget was recorded as seen. - **counted** (boolean) - Indicates whether the widget was counted. - **reason** (string) - Reason for the seen state. #### Response Example { "recorded": true, "counted": true, "reason": "success" } ``` -------------------------------- ### GET /api/goals/recent Source: https://github.com/heydeacon/skills/blob/main/_autodocs/errors.md Polls recent goals recording state for a given site key. Use to verify whether goals were recorded after a send. ```APIDOC ## [GET] /api/goals/recent ### Description Polls recent goals recording state for a given site key. Use to verify whether goals were recorded after a send. ### Method GET ### Endpoint /api/goals/recent ### Parameters #### Query Parameters - **k** (string) - Required - Site key for the goals recording state. ### Response #### Success Response (200) - **recorded** (boolean) - Indicates whether the goal was recorded. - **counted** (boolean) - Indicates whether the goal was counted. - **reason** (string) - Reason for the recording state. #### Response Example { "recorded": true, "counted": true, "reason": "success" } ``` -------------------------------- ### GET /api/goals/recent Source: https://github.com/heydeacon/skills/blob/main/_autodocs/endpoints.md Retrieves the most recent goals for a site, including named goals and those waiting to be named. Used by the deacon-goals verification endpoint and for agents to discover founder-named goals. ```APIDOC ## [GET] https://heydeacon.com/api/goals/recent ### Description Retrieves the most recent goals for a site, including named goals and those waiting to be named. Used by the deacon-goals verification endpoint and for agents to discover founder-named goals. ### Method GET ### Endpoint https://heydeacon.com/api/goals/recent ### Parameters #### Query Parameters - **k** (string) - Required - The site's public widget key. ### Request Example ``` curl -s "https://heydeacon.com/api/goals/recent?k=SITE_KEY" ``` ### Response #### Success Response (200) - **goals** (array) - List of goal objects, newest first. - **name** (string) - The goal name. - **arrivedAt** (string) - ISO timestamp of when the goal arrived. - **from** (string) - The origin from which the goal was sent. - **named** (boolean) - Whether the founder named the goal on the dashboard. - **waiting** (array of strings) - Names of goals that have arrived but are not yet named. #### Response Example ```json { "goals": [ { "name": "Sign up", "arrivedAt": "2026-09-08T09:05:00+00:00", "from": "localhost", "named": true } ], "waiting": ["Upgraded"] } ``` ``` -------------------------------- ### Set window.deaconUser and window.deaconContext in plain HTML Source: https://github.com/heydeacon/skills/blob/main/skills/deacon-install/SKILL.md Place this script above the Deacon loader snippet in the same layout. deaconUser accepts only id, email, and name; deaconContext accepts up to 12 keys and is dropped if serialized JSON exceeds 1500 characters. Values should be strings, numbers, or booleans. ```html ``` -------------------------------- ### window.deaconContext Source: https://github.com/heydeacon/skills/blob/main/_autodocs/api-reference/widget-api.md Sets the visitor context for Deacon's AI. Up to 12 keys, serialized JSON under 1500 characters. Values should be strings, numbers, or booleans. Never include passwords, tokens, API keys, or internal IDs. ```APIDOC ## window.deaconContext ### Description Sets the visitor context for Deacon's AI. Up to 12 keys, serialized JSON under 1500 characters. Values should be strings, numbers, or booleans. Never include passwords, tokens, API keys, or internal IDs. ### Usage Set the `window.deaconContext` object before the Deacon script runs. ### Example ```html ``` ### Allowed Contents - plan - subscription state - role - seat count - trial end - whether onboarding is finished ### Constraints - Maximum 12 keys - Serialized JSON must be under 1500 characters - Values must be strings, numbers, or booleans - Never include passwords, tokens, API keys, or internal IDs ``` -------------------------------- ### JSON body from goal beacon (development address) Source: https://github.com/heydeacon/skills/blob/main/_autodocs/endpoints.md Documented response from development addresses when a goal fires. 'reason' can be localhost, automated-browser, origin-not-allowed, no-page-url, no-name, or bot. 'recorded: true' indicates the goal arrived and wiring works; 'counted' is false from development addresses. ```json { "recorded": true, "counted": false, "reason": "localhost" } ``` -------------------------------- ### curl -s https://heydeacon.com/api/widget/seen?k=SITE_KEY Source: https://github.com/heydeacon/skills/blob/main/skills/deacon-install/SKILL.md Call the sightings endpoint to check whether a page loaded the Deacon snippet. Replace SITE_KEY with your site key; if you were given a prompt, it names the key and carries this address with the key already in it. ```bash curl -s "https://heydeacon.com/api/widget/seen?k=SITE_KEY" ``` -------------------------------- ### Append Deacon goals note to agent instructions Source: https://github.com/heydeacon/skills/blob/main/skills/deacon-goals/SKILL.md Adds a short section to the project's agent instructions file (AGENTS.md, CLAUDE.md, or equivalent) so the next agent knows the Deacon goals exist. The note lists the goals and where each fires, and reminds that names must match the dashboard exactly, with a curl command to verify. ```markdown ## Deacon goals The Deacon loader sends goals to the founder's analytics dashboard. The goals and where each fires: - Sign up: the registration form's submit (data-deacon-goal). - Paywall hit: the upgrade dialog's open button (data-deacon-goal). - Upgraded: the checkout success page (window.Deacon.track). Names must match the dashboard exactly. Check they arrive with `curl -s "https://heydeacon.com/api/goals/recent?k=SITE_KEY"`, using the `data-key` value from the loader. ``` -------------------------------- ### Deacon.track(name, props?) Source: https://github.com/heydeacon/skills/blob/main/_autodocs/api-reference/widget-api.md Sends a goal to the Deacon backend. Counts once per visit regardless of how many times it fires. Never put personal data in the details. ```APIDOC ## Deacon.track(name, props?) ### Description Sends a goal to the Deacon backend. Counts once per visit regardless of how many times it fires. Never put personal data in the details. ### Signature `track(name: string, props?: Record): void` ### Parameters | Parameter | Type | Required | Default | Description | |-----------|------|----------|---------|-------------| | `name` | `string` | yes | — | The goal's name, exactly as the founder wrote it | | `props` | `Record` | no | — | Optional details: up to thirty keys, each a short string, a number or a boolean, kept with the goal | ### Returns `void` ### Example ```js async function onExport() { await exportReport(); window.Deacon?.track('Exported', { format: 'csv' }); } ``` For a goal sent as a page opens (e.g., the page after a successful checkout), wait for the loader, which the window `load` event guarantees: ```js window.addEventListener('load', () => { window.Deacon?.track('Upgraded', { plan: 'pro' }); }); ``` ``` -------------------------------- ### Set window.deaconContext with visitor context Source: https://github.com/heydeacon/skills/blob/main/_autodocs/api-reference/widget-api.md Assigns the visitor's context to window.deaconContext before the Deacon script runs. Up to 12 keys and 1500 characters of JSON; values must be strings, numbers, or booleans. Never include passwords, tokens, API keys, or internal IDs. ```html ``` -------------------------------- ### Identify user and set context on sign-in/sign-out Source: https://github.com/heydeacon/skills/blob/main/skills/deacon-install/SKILL.md Use this in code that hears sign-in state, e.g., a single-page app on Supabase auth. Set both on sign-in and sign-out. The optional chaining prevents errors if Deacon hasn't loaded yet. Wait until the app knows who is signed in to avoid resetting the visitor. ```javascript // once the app knows who is signed in, including a session it restores on load window.deaconUser = { id: user.id, email: user.email, name: user.name }; window.Deacon?.identify(window.deaconUser); // on sign-out, so the next person on this computer starts fresh window.deaconUser = null; window.Deacon?.identify(null); window.Deacon?.setContext(null); ``` -------------------------------- ### Sightings response before anything has loaded Source: https://github.com/heydeacon/skills/blob/main/skills/deacon-install/SKILL.md Expected JSON response from the sightings endpoint before any page has loaded the snippet. All fields are null. ```json {"seen": null, "latest": null, "refused": null, "signedIn": null} ``` -------------------------------- ### Deacon.open(), Deacon.close(), Deacon.toggle() Source: https://github.com/heydeacon/skills/blob/main/_autodocs/api-reference/widget-api.md Controls the Deacon widget visibility. These methods take no parameters and return nothing. They are available as soon as the script has run. ```APIDOC ## Deacon.open(), Deacon.close(), Deacon.toggle() ### Description Controls the Deacon widget visibility. These methods take no parameters and return nothing. They are available as soon as the script has run. ### Signatures - `open(): void` - `close(): void` - `toggle(): void` ### Parameters None ### Returns `void` ### Example ```html ``` ``` -------------------------------- ### Loader Script Source: https://github.com/heydeacon/skills/blob/main/_autodocs/api-reference/widget-api.md Loads the Deacon widget in the background. Must be included exactly once per page with the site's public widget key. ```APIDOC ## Loader Script ### Description Loads the Deacon widget asynchronously. The widget only appears on allowed domains and counts client-side navigations in SPAs. ### Usage Include the script tag with the `data-key` attribute set to your public widget key. ### Parameters - **data-key** (string) - Required - The site's public widget key from the dashboard. ### Example ```html ``` ``` -------------------------------- ### Deacon.setContext(values) Source: https://github.com/heydeacon/skills/blob/main/_autodocs/api-reference/widget-api.md Merges context values into the existing context. Use for frequently changing context like plan upgrades. Passing null clears all context. ```APIDOC ## Deacon.setContext(values) ### Description Merges context values into the existing context. Use for frequently changing context like plan upgrades. Passing null clears all context. ### Signature `setContext(values: Record | null): void` ### Parameters | Parameter | Type | Required | Default | Description | |-----------|------|----------|---------|-------------| | `values` | `Record \| null` | yes | — | Context values to merge; a key set to `null` is removed; `setContext(null)` clears all | ### Returns `void` ### Example ```js window.Deacon?.setContext({ plan: 'Team', state: 'active' }); ``` ``` -------------------------------- ### Initial response with all null fields Source: https://github.com/heydeacon/skills/blob/main/_autodocs/endpoints.md Response when no sighting exists yet. All members are null until the corresponding sighting occurs. ```json {"seen": null, "latest": null, "refused": null, "signedIn": null} ``` -------------------------------- ### Blade: Track goal on window load event Source: https://github.com/heydeacon/skills/blob/main/skills/deacon-goals/SKILL.md Sends a goal from a page that proves a moment happened, such as after registration or checkout. Runs on the window's load event, which waits for the loader. ```blade @push('scripts') @endpush ``` -------------------------------- ### window.deaconUser Source: https://github.com/heydeacon/skills/blob/main/_autodocs/api-reference/widget-api.md Global variable that identifies the signed-in user. Must be set before the loader script runs. Set to null for signed-out users. ```APIDOC ## window.deaconUser ### Description Sets the current user's identity for the widget. Read once by the loader, so it must be placed above the loader script. ### Type Declaration ```ts deaconUser?: { id?: string | number; email?: string; name?: string } | null; ``` ### Fields - **id** (string | number) - Optional - The app's id for the user - **email** (string) - Optional - The user's email - **name** (string) - Optional - The user's name ### Example (signed-in) ```html ``` ### Example (signed-out) ```html ``` ``` -------------------------------- ### Browser deaconUser with token function Source: https://github.com/heydeacon/skills/blob/main/skills/deacon-install/SKILL.md Defines window.deaconUser with a token function that fetches /deacon/token with the nonce. Returns an empty string on 204, throws on other non-OK statuses, and returns the token text on success. Must be kept out of JSON serialization and called only by Deacon. ```js window.deaconUser = { id: 'u_123', email: 'ana@studio.com', name: 'Ana Ruiz', token: (nonce) => fetch('/deacon/token', { method: 'POST', credentials: 'same-origin', headers: { 'Content-Type': 'application/json' }, body: JSON.stringify({ nonce }), }).then((r) => { if (r.status === 204) return ''; if (!r.ok) throw new Error('Deacon token route answered ' + r.status); return r.text(); }), }; ``` -------------------------------- ### Deacon.identify(user) Source: https://github.com/heydeacon/skills/blob/main/_autodocs/api-reference/widget-api.md Replaces who is signed in. Use this when the app learns auth state after page load (e.g., SPA on Supabase auth). Passing null clears the user. ```APIDOC ## Deacon.identify(user) ### Description Replaces who is signed in. Use this when the app learns auth state after page load (e.g., SPA on Supabase auth). Passing null clears the user. ### Signature `identify(user: { id?: string | number; email?: string; name?: string } | null): void` ### Parameters | Parameter | Type | Required | Default | Description | |-----------|------|----------|---------|-------------| | `user` | `{ id?: string \| number; email?: string; name?: string } \| null` | yes | — | Replaces who is signed in; `null` clears it | ### Returns `void` ### Example ```js // once the app knows who is signed in, including a session it restores on load window.deaconUser = { id: user.id, email: user.email, name: user.name }; window.Deacon?.identify(window.deaconUser); // on sign-out, so the next person on this computer starts fresh window.deaconUser = null; window.Deacon?.identify(null); window.Deacon?.setContext(null); ``` ``` -------------------------------- ### Set context with Deacon.setContext Source: https://github.com/heydeacon/skills/blob/main/skills/deacon-install/SKILL.md Use this to update context that changes often, like a plan upgrade. It merges into existing context; a key set to null removes it, and setContext(null) clears all. ```javascript window.Deacon?.setContext({ plan: 'Team', state: 'active' }); ``` -------------------------------- ### window.Deacon.track Source: https://github.com/heydeacon/skills/blob/main/_autodocs/api-reference/deacon-goals.md Fires a goal for anything that is not a click. Accepts optional details: up to thirty keys, each a short string, a number, or a boolean, kept with the goal. ```APIDOC ## [CALL] window.Deacon.track ### Description Fires a goal for anything that is not a click. Accepts optional details: up to thirty keys, each a short string, a number, or a boolean, kept with the goal. ### Method `window.Deacon.track(goalName, details?)` ### Parameters - **goalName** (string) - Required - The name of the goal to fire. - **details** (object) - Optional - Up to thirty keys, each a short string, a number, or a boolean. ### Example ```js window.Deacon?.track('Upgraded', { plan: 'pro' }); ``` ``` -------------------------------- ### Set deaconUser for signed-in page Source: https://github.com/heydeacon/skills/blob/main/_autodocs/api-reference/widget-api.md Assigns the signed-in user's id, email, and name to window.deaconUser. Must be placed above the loader snippet. Deacon treats this as a hint, not proof. ```html ``` -------------------------------- ### Open Deacon widget with a button Source: https://github.com/heydeacon/skills/blob/main/_autodocs/api-reference/widget-api.md Calls Deacon.open() when the button is clicked. This is the only way to open the widget when the Help button is hidden on the Appearance page. ```html ``` -------------------------------- ### Track goal from handler after action Source: https://github.com/heydeacon/skills/blob/main/skills/deacon-goals/SKILL.md Send a goal without a click from the handler once the action has happened. Uses window.Deacon?.track with a name and optional properties. ```tsx async function onExport() { await exportReport(); window.Deacon?.track('Exported', { format: 'csv' }); } ``` -------------------------------- ### Deacon widget loader script tag Source: https://github.com/heydeacon/skills/blob/main/skills/deacon-install/SKILL.md Paste this snippet just before the closing tag on every page where the widget should appear. The data-key attribute must be replaced with the site's own key; the key shown is a placeholder. It loads in the background and never blocks the page. ```html ``` -------------------------------- ### Set context with Deacon.setContext Source: https://github.com/heydeacon/skills/blob/main/_autodocs/api-reference/widget-api.md Merges context values into the existing context, useful for frequently changing data like plan upgrades. A key set to null removes it; setContext(null) clears all. ```js window.Deacon?.setContext({ plan: 'Team', state: 'active' }); ``` -------------------------------- ### Deacon.setContext(values) Source: https://github.com/heydeacon/skills/blob/main/skills/deacon-install/SKILL.md Merges context values into the existing context. Use it for frequently changing information like plan or subscription state. Pass null to clear all context. ```APIDOC ## Deacon.setContext(values) ### Description Merges context values into the existing context. Use it for frequently changing information like plan or subscription state. Pass null to clear all context. ### Method Function call ### Parameters - **values** (Record | null) - Required - An object of key-value pairs to merge into the context. Set a key to null to remove it. Pass null to clear all. ### Request Example ```js window.Deacon?.setContext({ plan: 'Team', state: 'active' }); ``` ### Response No return value. ``` -------------------------------- ### Next.js: Set deaconUser and deaconContext in root layout Source: https://github.com/heydeacon/skills/blob/main/skills/deacon-install/SKILL.md Use in the root layout (server component) with the app's existing session helper. The safe function escapes < to \u003c to prevent script-tag injection; JSON.stringify alone is insufficient. Never interpolate a raw string into the block. ```tsx const session = await auth(); const safe = (value: unknown) => JSON.stringify(value).replace(/ {children} {session?.user && ( @endauth ``` -------------------------------- ### deacon-goal-- class Source: https://github.com/heydeacon/skills/blob/main/_autodocs/api-reference/deacon-goals.md Fires a goal on click or submit for hosts that only expose a class field. A `+` stands for a space in the goal name. ```APIDOC ## [CLASS] deacon-goal-- ### Description Fires a goal on click or submit for hosts that only expose a class field. A `+` stands for a space in the goal name. ### Usage Add the `deacon-goal--` class to an HTML element. The goal name follows the prefix, with spaces replaced by `+`. ### Parameters - **goal name** (string) - Required - The name of the goal to fire, with spaces replaced by `+`. ### Example ```html ``` ``` -------------------------------- ### Deacon Loader Script Tag Source: https://github.com/heydeacon/skills/blob/main/_autodocs/configuration.md Loads the Deacon widget loader script with a public key. Place before closing in the shared layout. The data-deaconUser/data-deaconContext block goes above this snippet. ```html ``` -------------------------------- ### HTML attribute data-deacon-goal for click/submit goals Source: https://github.com/heydeacon/skills/blob/main/_autodocs/api-reference/deacon-goals.md Fires a goal on click or submit without blocking the element's default behavior. The loader holds navigation for up to five seconds while the goal is sent, then lets it through. ```html ```