Logo

Tracking Events

postMessage events emitted by the Shop for analytics wiring.

For iframe embeds, the Shop emits window.parent.postMessage(...) on key lifecycle moments. Use these to wire your own analytics.

Event catalog

EventWhenPayload
shop.readyFirst render after handshake{ type, partnerCode, userId }
shop.errorUnrecoverable error (auth, network){ type, code, message }
shop.purchase_intentUser clicks "Buy" on a plan{ type, sku, price, currency }
shop.close_requestUser taps the close affordance{ type }
shop.payment_successOrder paid{ type, orderId, sku, amount, currency } — pending payment return finalization

Listener example

window.addEventListener("message", (event) => {
  // ALWAYS validate origin against your configured Shop host
  if (event.origin !== "https://<shop-host>") return;

  const msg = event.data;
  if (msg?.type === "shop.close_request") {
    document.getElementById("bluecom-iframe")?.remove();
  }
  // handle other events
});

Validate event.origin

Always check event.origin against your configured Shop hostname before trusting the payload. Otherwise any page can forge events.

Native WebView

The same events will be exposed via the WebView's JavaScript bridge (window.webkit.messageHandlers on iOS, Android.postMessage on Android). Bridge contract will be published alongside the payment return spec.

On this page