Widget Setup
Installation
Add the widget to your product page template:
<div id="swiftreviews"></div><script> window.__swiftreviews = { shopDomain: "{{ shop.permanent_domain }}", productId: "{{ product.id }}", };</script><script src="https://cdn.swiftreviews.app/widget.js" async defer></script>Configuration Options
The window.__swiftreviews object accepts:
| Property | Type | Required | Description |
|---|---|---|---|
shopDomain | string | Yes | Your .myshopify.com domain |
productId | string | Yes | Shopify product ID |
apiUrl | string | No | Custom API URL (for self-hosted) |
How It Works
- The widget script loads asynchronously (never blocks page rendering)
- Reads configuration from
window.__swiftreviews - Fetches the review summary from the edge cache (~10ms)
- Renders the rating summary, distribution, and first page of reviews
- Lazy-loads the photo lightbox, submission form, and pagination as needed
Performance
- Bundle size: <5KB gzipped
- First render: <100ms after script loads
- API latency: <10ms from edge cache
- Zero layout shift: Fixed-height containers prevent CLS