# Put the Mementom badge on a retailer site The QR on the badge represents the current visit. Scanning it opens a standalone Mementom ceremony on the phone. The desktop shows Connected only after the retailer server verifies the result. The shopper can also select Continue on this device for the same pending request. ## Tell your coding agent > Put the Mementom badge in our storefront header. Use our registered app, the > maintained session badge and the Node adapter. Keep the shopper on the > current product page. Test scanning from a second browser and show that only > the requesting desktop visit becomes connected. After connecting, open Activity > from the badge and verify that it shows the shopping activity for this site. For Worker-hosted sites, use the [Worker badge recipe](worker-badge.md). It uses the same manifest, badge and server contract, with explicit backend requirements. ## Install in the retailer project 1. Through Developer MCP, inspect the registered app. Configure its HTTPS website and exact callback (normally `/mementom/return`) with account access off. Keep the company server credential, RSA private key and stable cookie key in the backend secret store. Supply only the public RSA key to setup. 2. Call `mementom_developer_get_backend_recipe` with `file` set to `adapter`, `sdk`, `browser` and `example` to install the maintained server files. Mount the Node adapter before the ordinary application routes as shown in the [Node guide](node-backend.md). Multiple instances must share the atomic attempt store and cookie key. 3. Request the same recipe with `{"file":"badge"}`. It returns the entry point and a manifest of public files with their relative paths, download URLs and SHA-256 hashes. Install the files together under the site's public `/mementom-badge/` directory, preserving paths and the encoder license. To retrieve individual file contents via MCP, pass `{"file":"badge","asset":"session-badge.mjs"}` or another listed path. The [download manifest](/developers/downloads/session-badge.json) provides the same files. Serve JavaScript, CSS and SVG with their normal MIME types. 4. Mount the badge on a button where the shopper should see it. A framework component should mount once and call `badge.dispose()` when it unmounts. ```html ``` The component loads the shared stylesheet, draws the QR, checks connection status, handles expiration and offers a new code. For local development, supply your fixed Mementom `authorizationOrigin` and `websiteOrigin`. Clicking a connected badge opens the same hosted Mementom Activity window on every integrated storefront. The shopper can search saved actions, manage sharing, delete eligible activity, or disconnect the current visit. Install the badge files and the maintained Node adapter together. Pass `onConnected` and `onDisconnected` to refresh retailer content if needed. When upgrading an older integration, remove the retired `onActivity` option and its local dialog. Use the adapter’s `/mementom/activity` route to supply activity for the connected visit. ## What runs on each side - The browser asks its own Node adapter to start the badge. The adapter creates a connection request and creates a relay for that exact application and request. It keeps the watcher credential on the server. The badge receives a short phone URL and expiry and renders the same QR on the badge and in its expanded view. The URL contains only an opaque, expiring reference after the `#`. On the phone, Mementom clears that reference from the address bar and retrieves the signed request privately. A claim binds the handoff to that phone so it can resume. The relay retains the verified result until the retailer confirms receipt or the handoff expires. Cancelling a pending request closes it immediately. An unscanned link expires within ten minutes. - The phone completes Mementom's secure ceremony. The desktop badge polls its own adapter. The adapter verifies the return and exchanges the one-use code for the originating visit. The browser checks server connection status before updating the badge. If an exchange response is lost, the adapter can recover the same session with its private watcher. Only after saving the result does it acknowledge the handoff. A scan alone leaves the visit pending. - A shopper who opens the standalone secure window can click its QR icon to move that particular operation to their phone. The icon issues its own short link for the operation already in progress. The secure window tracks the result and continues the original request. - The retailer decides what to do with the connected visit. Read permitted values in the catalog or recommendation handler with `adapter.readInsights(req)`. After durably saving a trusted retail event, call `adapter.ingestInsights(req,event)` with its stable ID, original timestamp and approved dataset fields. Add `activity` metadata with the registered store `origin`, the actual `action`, a shopper-readable `label` such as `Viewed Canvas Daypack`, and `receiptSharing: true`. This creates a receipt the shopper can control in Activity. Keep customer identifiers and private account details out of the label. Give each action its own label and use the same timestamp and label when an observation writes to more than one approved dataset. The badge opens an empty Activity window until this site has saved activity for the keyring. - The badge reads `/mementom/activity` on the retailer's origin. The Node adapter sends the current session and registered store origin to Mementom from the server. It returns only display fields and the site's opaque Activity context. Mementom verifies owner authority separately for sharing and deletion. **Disconnect from this visit** in Activity settings ends the current site's visit. It leaves other visits and the person's retained keyring available. ## Test the storefront Use a test keyring eligible for the retailer's connection. Harbor and the hosted GTM storefronts have a registered public connection for a new, passwordless single-key keyring. Installing the badge on an external site does not grant that permission. Test the retailer's own registration and keyring policy. 1. Open the same product page in two independent desktop browser profiles. Scan the first badge with a phone and complete the secure step. 2. Reload both desktops. Check the badge and the server's `/mementom/status` on each. Only the visit that showed the QR should be connected. 3. Start two fresh visits. On the first desktop, open the badge, choose **Continue on this device**, then open the QR icon in the standalone secure window. If the window opens on first-key creation, choose **Use existing key** to reach the keyring screen and its QR icon. Scan that QR and repeat the same two status checks. 4. Try an ineligible keyring. Both desktop visits should remain disconnected. 5. Open the connected badge and confirm Activity opens in its own window. Save a real storefront action and check its wording. Change its sharing, cancel a secure authorization request, and confirm Activity stays open. Open Activity settings, choose **Disconnect from this visit**, and verify that only this visit ends. Also test cancellation, expiry, retry, return and sign-out before release.