Options reference

Every option the constructor accepts. Most appearance and copy settings are better set once in your Oyster dashboard than passed from code: see where config comes from.

Options reference

What you can configure
  • publicKey (string, required): your widget public key, from your Oyster dashboard. Safe to put in page code.
  • key (string, deprecated): the old way to pass a key. Use publicKey instead. Only read when publicKey is missing.
  • callback (function, required): called with every widget event. See Events.
  • onCollectPayment (function, optional): collect a scan or booking payment on your own gateway. Only called when your account is set up to collect these payments on your own gateway — see Collecting on your own gateway and Collecting bookings on your own gateway.
  • mode ("float" | "inline", optional): defaults to "float".
  • autoOpen (boolean, optional): defaults to true. Auto-opens the widget on init. In float mode the launcher is always shown — autoOpen only controls whether the widget also surfaces immediately. Set to false to keep only the launcher visible until the user clicks it (or you call open()).
  • user (object, optional): { id, name?, email? }. If omitted, the widget can prompt for email when needed.
  • container (HTMLElement | string, inline only): where the widget mounts.
  • inlineWidth (number | string, optional, inline only): how wide the widget is inside your container. Defaults to "100%". Never wider than the container. See Setting an inline widget's width.
  • inlineHeight (number | string, optional, inline only): how tall the widget is inside your container. Defaults to "100%". See Setting an inline widget's height.
  • primaryColor (string, optional): the widget's main brand color, used for buttons and highlights. Defaults vary by widget type.
  • primaryTextColor (string, optional): the color of text and icons drawn on primaryColor. When unset, black or white is picked for contrast.
  • secondaryColor (string, optional): a warm tint for background surfaces. Derived from primaryColor when unset.
  • tertiaryColor (string, optional): a cool tint for background surfaces. Derived from primaryColor when unset.
  • displayLogo (boolean, optional): whether to show the Oysterskin logo. Defaults to true.
  • logoUrl (string, optional): custom logo image URL. When provided with displayLogo: true, replaces the default SVG logo with your custom image.
  • introMessage (string, optional): launcher tooltip title text.
  • messageBody (string, optional): launcher tooltip body text.
  • displayHoverPopup (boolean, optional, float only): defaults to true. Show the launcher tooltip when the user hovers the launcher.
  • displayAutoPopup (boolean, optional, float only): defaults to true. Auto-show the launcher tooltip (with a close button) once per browsing session per publicKey, after the host page finishes loading. Suppressed when autoOpen: true or once the user has opened the widget at least once.
  • budgetCurrency (string, optional): the currency your budgetRanges figures are in, as a code such as "NGN". Use your account's pricing currency: ranges in a different currency are not used.
  • budgetRanges (object, optional): the budget bands the shopper picks from. Each of low, mid and premium takes { min, max, label?, tooltip? }. Pass one set, { low, mid, premium }, or one set per currency, { NGN: { low, mid, premium } }. See Budget ranges example.
  • conversationStarters (string[], optional, chat/unified only): suggested questions the shopper can tap to start a chat.
  • voiceMicMode ("ptt" | "hands-free", optional, voice agent only): how the microphone starts on a voice call. "ptt" (the default) sends audio only while the shopper holds the mic button, which works better in noisy places. "hands-free" listens all the time. The shopper can switch during the call.
  • onOpenCheckout (function, optional): open a checkout page for the widget where it cannot open a browser window itself, such as a WebView in a mobile app. Leave it unset on a website. See Mobile app.
  • app (string, optional): where the widget is embedded. Set "vendor-app" when it runs inside your own mobile app. That labels its scans as coming from your app in your reports, and lets an inlineHeight fill the whole screen. Any other value is treated as a normal website embed.
  • spinWheel (boolean, optional): set to false to leave Spin the Wheel out of this embed, for example on a page where shoppers cannot check out. Defaults to the wheel settings in your Oyster dashboard.
  • widgetTypes (("scan" | "chat" | "consultation" | "voice-agent")[], unified only): restrict which tiles appear in the home gallery. Omit (or pass empty) to show all. The value set in your Oyster dashboard is used when this option is not provided.
  • launcherPosition (object, optional, float only): where the launcher sits — { corner?, offsetX?, offsetY? }. See Moving the launcher.
  • location (string | number, optional): which of your stores this embed belongs to. See Reporting scans against a store.
  • externalUserRef (string, optional): your own id for the shopper, echoed back on your scan.completed webhook. See Matching a scan to your customer.
  • meta (string, optional): anything else you want echoed back on that scan's webhooks. See Matching a scan to your customer.
  • zIndex (number, optional, float only): the stacking order the widget paints at. See Putting your own dialogs above the widget.
  • language (string, optional): the language the widget speaks to shoppers. See Showing the widget in your shoppers' language.
  • vendor (string, required with a partner key): the slug of the business this embed is for. See Embedding for a business you manage.

Setting an inline widget's width: inlineWidth

With mode: "inline", the widget sits inside your container like any other element on the page. inlineWidth sets how wide it is. Pass a number for pixels (480 means 480px) or any CSS size as a string, such as "60%". It defaults to "100%", the full width of the container, and the widget is never wider than the container whatever you pass. Float mode ignores it.

const instance = OysterskinWidget.createScanWidget({
  publicKey: "YOUR_PUBLIC_KEY",
  mode: "inline",
  container: "#oyster-scan",
  inlineWidth: 480,
  callback: (message) => console.log(message),
})

Setting an inline widget's height: inlineHeight

inlineHeight sets how tall an inline widget is. Like inlineWidth, a number is pixels and a string is any CSS size, such as "80vh". Float mode ignores it.

It defaults to "100%" of the container, which only works if the container has a height of its own. If it has only a min-height, or no height at all, 100% of it is nothing and the widget shows up as a blank strip. Give the container a fixed height, or pass a fixed inlineHeight. 720 fits the scan flow on most screens.

const instance = OysterskinWidget.createScanWidget({
  publicKey: "YOUR_PUBLIC_KEY",
  mode: "inline",
  container: "#oyster-scan",
  inlineHeight: 720,
  callback: (message) => console.log(message),
})

A height you set is capped at 85% of the screen height, so a shopper on a phone always has some of your page left to scroll on. Inside your own mobile app, where the widget is meant to fill the screen, pass app: "vendor-app" to lift the cap.

Both values set the size the widget starts at. Once loaded, the widget can change its own height to fit what it is showing.

Embedding for a business you manage

A partner account has one public key for every business it manages. Pass that key with vendor, the slug of the business the page is for, and the widget runs as that business: its bookings, scans and customers are its own, shown in your widget styling with its name and logo.

OysterskinWidget.createConsultationWidget({
  publicKey: 'YOUR_PARTNER_PUBLIC_KEY',
  vendor: 'lekki-skin',
  callback: () => {},
})

Every create*Widget factory takes the option. A business's slug is the one returned when you create or list it, and the page must be on one of the domains allowed for your partner widget. Without vendor, or with a business you do not manage, the widget does not start. A business's own public key needs no vendor.

Reporting scans against a store

Scans from an embed are reported as online, which is what you want on a normal storefront — the shopper is not in any of your stores. Set location where they are: an in-store tablet, a kiosk, or a page that belongs to one branch. Scans from that embed are then reported against that store, and you can filter your scan log by it.

Pass the location's reference — the short handle you set on the location in your Oyster dashboard — or its numeric id. The reference is the easier one to keep right in a theme setting someone else fills in.

OysterskinWidget.createScanWidget({
  publicKey: 'YOUR_PUBLIC_KEY',
  location: 'vi-store',
  callback: () => {},
})

One embed, one store. If a location you pass is not one of yours it is ignored and the scan still runs, reported as online — so a wrong value costs you the reporting, never the scan.

Matching a scan to your customer

Set externalUserRef to your own id for whoever is about to scan. It comes back on your scan.completed webhook, so you can attach the scan to that customer in your own system without Oyster holding the link.

OysterskinWidget.createScanWidget({
  publicKey: 'YOUR_PUBLIC_KEY',
  externalUserRef: 'cust_8421',
  callback: () => {},
})

It is opaque to us: never parsed, never shown to the shopper, never treated as a contact detail. Prefer your customer id or a per-session token over an email or a phone number — a reference that means something only inside your system is all this is for. Set it per visitor, and leave it off when you do not know who they are.

It does not change what the widget asks the shopper for. That is your Collect from the customer setting under Scan Settings, and the contact step disappears only when that is set to Nothing. With that combination this reference is the only identity a scan carries, and one sent without it still runs: there is simply nothing to match it against afterwards.

meta is the same idea for everything that is not identity: an order id, a campaign, a small JSON blob. It is passed through untouched and comes back on every webhook for that scan. See Webhooks.

OysterskinWidget.createScanWidget({
  publicKey: 'YOUR_PUBLIC_KEY',
  externalUserRef: 'cust_8421',
  meta: 'order:8421|campaign:spring',
  callback: () => {},
})

Both are capped at 500 characters, and both arrive on the webhook as null when you send nothing, so your receiver can read them without checking whether the keys exist.

Moving the launcher

By default the launcher sits in the bottom-right corner, 28px from each edge (16px on phones). Set launcherPosition to put it somewhere else — useful when your own chat bubble, cookie banner or back-to-top button already owns that corner.

  • corner ("bottom-right" | "bottom-left" | "top-right" | "top-left"): defaults to "bottom-right".
  • offsetX (number): distance in px from the left or right edge, whichever the corner names.
  • offsetY (number): distance in px from the top or bottom edge.

The offsets are distances from the corner, not viewport coordinates, so the launcher keeps its corner on every screen size. Omit either one to keep the default margin for that axis. The panel the launcher opens follows it, growing out of the same corner. An offset large enough to push the launcher off a narrow screen is pinned to the edge instead, so it stays reachable on a phone.

const instance = OysterskinWidget.createScanWidget({
  publicKey: "YOUR_PUBLIC_KEY",
  launcherPosition: {
    corner: "bottom-left",
    offsetX: 24,
    offsetY: 96,
  },
  callback: (message) => console.log(message),
})

You can also set the position in your Oyster dashboard, under Widget Manager, and leave it out of your code. Passing it here wins over the saved value, field by field: pass only corner and the saved offsets still apply.

Putting your own dialogs above the widget

By default the widget paints at the very top of the page's stacking order, so it stays visible over any storefront. If your page has a dialog of its own that has to come first, such as a newsletter or sign-up modal that opens on load, an age gate or a consent banner, set zIndex to a number below your dialog's own. The shopper finishes with your dialog, and the widget is still there behind it.

  • zIndex (number): the widget's topmost layer, which is the panel the scan runs in. The launcher and its tooltip sit one below. Defaults to 2147483647; the lowest accepted value is 1.

So a page whose modal sits at 9999 wants a widget at 9000, not at 9999: equal layers leave the browser to break the tie by document order. Nothing else about the widget changes: the launcher stays in its corner and the panel still opens out of it.

const instance = OysterskinWidget.createScanWidget({
  publicKey: "YOUR_PUBLIC_KEY",
  // Our own sign-up modal is at 9999, so keep the widget under it.
  zIndex: 9000,
  callback: (message) => console.log(message),
})

You can also set this in your Oyster dashboard, under Widget Manager, and leave it out of your code. Passing it here wins over the saved value.

Showing the widget in your shoppers' language

The widget speaks English, French and Arabic. Pick one for every shopper in your Oyster dashboard, under Widget Manager, or let each shopper's browser decide. Set language when one page needs to differ, such as the French version of a bilingual storefront.

  • language (string): "en", "fr", "ar", or "auto" for each shopper's browser language (English when the browser asks for one the widget does not speak). Arabic lays the widget out right to left.

A language the widget does not speak is ignored, and the one saved in your dashboard applies instead. Text you write yourself, such as the launcher's tooltip, your product names and your consent notice, is shown as you wrote it, so write it in the language you choose here.

const instance = OysterskinWidget.createScanWidget({
  publicKey: "YOUR_PUBLIC_KEY",
  // This is the French version of the store.
  language: "fr",
  callback: (message) => console.log(message),
})

Passing it here wins over the saved value.

Budget ranges example

const instance = OysterskinWidget.createScanWidget({
  publicKey: "YOUR_PUBLIC_KEY",
  budgetCurrency: "NGN",
  budgetRanges: {
    NGN: {
      low: { min: 30000, max: 60000, label: "Low Budget" },
      mid: { min: 60000, max: 100000, label: "Mid Budget" },
      premium: { min: 100000, max: 200000, label: "Premium" }
    }
  },
  callback: (message) => console.log(message),
});

Custom logo example

Use logoUrl to display your own logo instead of the default Oysterskin logo:

const instance = OysterskinWidget.createScanWidget({
  publicKey: "YOUR_PUBLIC_KEY",
  mode: "float",
  displayLogo: true,
  logoUrl: "https://your-domain.com/logo.png",
  callback: (message) => console.log(message),
});