LockStock docs

JavaScript API

Tell the widget which product is on the page, open the chat from your own button and report purchases.

The snippet stub defines window.lockstock before the widget loads. Call it at any moment: calls made early are queued and run once the widget is ready.

lockstock(command, payload);

Unknown commands and invalid payloads are ignored. Calls never throw into your page.

setProduct

Tells the consultant which product the shopper is looking at, so «а этот подойдёт?» needs no explanation. Call it on every product page; in a single-page app, call it again after each navigation.

lockstock('setProduct', { externalId: 'NB-1001' });
FieldTypeNotes
externalIdstringThe product ID from your feed (<offer id="…">)

open

Opens the consultant, optionally with a question already typed. Use it for your own «Ask AI» buttons, or after hiding ours with launcher.enabled: false.

lockstock('open');
lockstock('open', { text: 'Какой выбрать для учёбы?' });
FieldTypeNotes
textstring, optionalPut into the message box; the shopper sends it

purchase

How it is counted

An order is attributed to LockStock when the same visitor searched with the widget or talked to the consultant within the 7 days before it. An order number is counted once, however many times it is reported. The A/B report in the dashboard arrives with the analytics release.

Reports an order so we can measure how LockStock affects sales. Call it once on the order confirmation page, for every visitor — including the control group that never saw the widget.

lockstock('purchase', {
  orderId: '248315',
  totalMinor: 5248000,
  items: [{ productExternalId: 'NB-1001', qty: 1, priceMinor: 5248000 }],
});
FieldTypeNotes
orderIdstringYour order number
totalMinorintegerOrder total in minor units of your store's currency: kopecks, tiyn, … 52 480,00 ₽ is 5248000
items[].productExternalIdstringThe product ID from your feed
items[].qtypositive integerQuantity
items[].priceMinorintegerPrice per item in minor units

Amounts are integers on purpose: no rounding errors between your store and our reports.

На этой странице