Configuration

Every initSiteping option, with its real default and behavior.

All options of initSiteping(config). Only projectName plus one of endpoint / store are required.

Connection

SitepingConfig is a discriminated union over the two transport modes — endpoint or store, never both, never neither. TypeScript rejects the invalid combinations at compile time instead of leaving you to discover them at runtime:

initSiteping({ endpoint: "/api/siteping", store, projectName: "x" }); // ✗ both modes
initSiteping({ store, apiKey: "sk-…", projectName: "x" });           // ✗ HTTP-only option in store mode
initSiteping({ projectName: "x" });                                   // ✗ no transport
OptionTypeDefaultWhat it does
endpointstring—HTTP mode. URL of your SitePing API (e.g. /api/siteping)
storeSitepingStore—Store mode. Write to a store in the browser instead of HTTP — excludes endpoint, apiKey and headers
projectNamestring—Required in both modes. Scopes everything the widget reads and writes
apiKeystring—HTTP mode only. Sent as Authorization: Bearer <key> on every request
headersobject or function—HTTP mode only. Extra headers, static or computed per request (sync or async). Merged last, so an explicit Authorization here beats apiKey

The two halves are exported as SitepingHttpConfig and SitepingStoreConfig, which is what you want when a wrapper component takes the config as a prop and only supports one mode:

import type { SitepingHttpConfig } from "@siteping/widget";

function mountFeedback(config: SitepingHttpConfig) { /* endpoint guaranteed */ }

apiKey ships in your client bundle — every visitor can read it. Use it for internal tools already behind a login; on public sites prefer headers with a function that returns a short-lived token.

Visibility

OptionTypeDefaultWhat it does
forceShowbooleanfalseBypasses the production and viewport guards (never the SSR guard)
minViewportWidthnumber0Below this width the widget skips with onSkip("mobile"). The default renders at every width — phones get the compact layout. Before 0.11 the default was 768: set it to keep the widget off phones
position"bottom-right" | "bottom-left""bottom-right"Corner for the floating button
showAnnotationsTogglebooleantrueSet false to remove the marker-visibility toggle from the radial menu

Appearance

OptionTypeDefaultWhat it does
accentColorstring"#0066ff"Hex only (#RGB, #RRGGBB, #RRGGBBAA). Named colors, rgb(), hsl() etc. log a warning and fall back to the default
theme"light" | "dark" | "auto""light"auto reads the system preference once at init — an OS theme change mid-session doesn't re-theme the widget
localestring"en"Any BCP-47 tag; see Languages

Features

OptionTypeDefaultWhat it does
enableScreenshotbooleanfalseCapture a JPEG of the annotated area on submit — see Screenshots
enableRightClickCommentbooleanfalseRight-click anywhere to comment instantly — see Right-click comments
captureDiagnosticsboolean or objectfalseAttach recent console entries (max 50) and failed network requests (max 20, URL recorded without credentials, query string or hash) to each feedback. true enables both; an object picks channels and lower limits (maxConsoleEntries / maxNetworkEntries — larger values are clamped to 50 / 20, the server's caps)
deepLinkboolean or { param?: string }falseOn first load, focus the feedback referenced by ?siteping=<id> (or your custom param). Initial load only — for route changes, call focusFeedback()
identity{ name, email }—Pre-fill author fields from the host app's session (e.g. SSO, or Better Auth): skips the identity modal, never persisted to localStorage. It does not authenticate API requests — a server access policy does, from your session cookie on the same origin or a bearer token sent with headers. Read at init: remount the widget after an account change
panelActionsarray—Your own buttons and links in the feedback detail view — create a ticket, open it in your tracker. See Panel actions

Reviewer mode

OptionTypeDefaultWhat it does
readOnlybooleanfalseHide what triages feedback — resolve, reopen, delete, the bulk actions, "Delete all". Creating, browsing and replying stay

For a client who reviews while your team triages. On top of it, the widget hides what the server says this visitor may not do — its permissions — so a public widget in front of an apiKey offers no button that would answer 401, even without readOnly. Either way it only hides: the server decides what it accepts.

Page scoping

OptionTypeDefaultWhat it does
scopeAnnotationsByUrlbooleantrueOnly show markers created on the current page. Filtered both server-side and client-side, so annotations can't leak across pages
getPageScope() => { url, urlPattern }pathnameCustomize what "the current page" means — return a stable url (and optionally a template like /products/:id as urlPattern) so dynamic routes share their feedback
watchNavigationbooleantrueRe-fetch feedbacks on SPA navigation (History API patch + popstate/hashchange). Data only — it never scrolls or refocuses. Set false and call refresh() yourself to opt out

The default page scope is window.location.pathname — by construction it contains no query string, so tokens or search params in the URL never reach the server. If you provide getPageScope, keep that property: return a path or a template, not location.href.

Callbacks

OptionSignatureFires when
onFeedbackSent(feedback) => voidA feedback was successfully created
onCommentAdded(comment) => voidA reply was posted from a feedback's discussion thread
onError(error) => voidA submission or fetch failed, or one of your panel actions threw — see error handling
onOpen / onClose() => voidThe panel opened / closed
onAnnotationStart / onAnnotationEnd() => voidAn annotation session began / ended — pause chat bubbles or analytics overlays here
onSkip(reason) => voidThe widget decided not to render: "ssr", "production", or "mobile". Invalid config logs a console.error instead

Debug

OptionTypeDefaultWhat it does
debugbooleanfalseVerbose [siteping] lifecycle logging via console.debug
Edit on GitHub

On this page