How do I embed a Sorak wall on my website?
Put one div with your space’s slug and one script tag where the wall should appear. The script draws your approved testimonials inside a Shadow DOM, and changes you make in Sorak reach your site within about a minute.
The snippet
Replace my-slug with the slug from your space’s Share page. The snippet also appears there, ready to copy.
<div data-sorak-wall="my-slug"></div>
<script async src="https://sorak.app/embed.js"></script>The script is loaded from https://sorak.app/embed.js, and the widget fetches its data from the same origin. It has no dependencies, and each data-sorak-wall element on the page gets its own wall.
Attributes
Set these on the div. Anything not listed is ignored.
| Attribute | Values | Default |
|---|---|---|
data-sorak-wallRequired | The space's slug: letters, digits, hyphen or underscore, starting with a letter or digit. Find the slug on your space’s Share page. | None. A missing or malformed value leaves the element untouched. |
data-layoutOptional | masonry or list. Any value other than list gives masonry. | masonry |
data-maxOptional | A whole number above 0. Shows the newest N. A missing, zero or non-numeric value shows everything. | All approved testimonials, up to 200 |
data-sorak-originOptional | https://sorak.app. Rarely needed. Set it only if the wall does not load because your page bundles the script or loads it as a module. | The address the script was loaded from |
For example, a single-column wall with the six newest testimonials:
<div data-sorak-wall="my-slug" data-layout="list" data-max="6"></div>
<script async src="https://sorak.app/embed.js"></script>Layouts
| data-layout | Result |
|---|---|
masonry | Cards flow in columns of equal width. One column under 520 px wide, two from 520 px, three from 860 px, measured on the element that holds the wall, not the screen. |
list | One column, up to 680 px wide and centred in the element. |
The wall is a block that fills the element it is in. Set the width of the div to size the wall.
Theme, accent and badge
These are settings of the space, changed in Settings, not attributes. The embed code stays the same when you change them. On a Free space the wall renders light with the default accent whatever is saved.
| Setting | Free | Pro |
|---|---|---|
| Theme | Light | Light or dark |
| Accent colour (stars, focus ring) | Sorak blue, #1f45ff | Any hex colour you set |
| “Powered by Sorak” badge | Shown | Removed |
| Fair use, widget views per space per month | 10,000 | 250,000 |
| Allowed websites (where the embed loads) | Any website | Any, or up to 10 websites you list |
| “Shown: testimonials approved by …” line and Report link | Shown | Shown |
Allowed websites (Pro)
On Pro you can list up to 10 websites in your space’s Settings, one per line. The wall data is then sent only to pages on those websites and to Sorak’s own pages; a page anywhere else gets a refusal (HTTP 403) and the widget shows nothing. Likewise only those websites can show your hosted wall page in a frame (an iframe of /w/your-slug elsewhere stays blank; a frame inside a frame needs every page around it on the list). With an empty list, or on Free, the wall loads on any website.
example.com also covers www.example.com; *.example.com covers every subdomain but not example.com itself. Without a port any port matches; with one, only that port. Use names: IP addresses are not accepted.
A restricted wall is not cached at the edge (each view asks Sorak, and the visitor’s browser keeps it for up to a minute), because a shared cache cannot tell websites apart.
What it does not do: it stops other websites from showing your wall with the snippet or in a frame, nothing more. Opened directly, the hosted wall page stays public: anyone can read it and copy text from it by hand, and a program that is not a browser can pretend to be your website (a server-side scraper, for example). If your plan returns to Free, the list is kept but stops applying until you upgrade again.
Caching
- The wall data is cached at the edge for up to 60 seconds and never in the visitor’s browser (a wall limited to allowed websites is the exception: it is kept only in the visitor’s browser, for the same minute). An approval, rejection or deletion appears within about a minute and needs no change to your site.
- The script is cached for 5 minutes in browsers and 60 minutes at the edge, so a new release of the widget reaches your visitors within about an hour.
- The wall holds the newest 200 approved testimonials at most.
Single-page apps
The widget looks for walls when the page loads. If your framework adds the div later, call this once the element is in the page. An element that already has a wall is skipped.
window.Sorak.mount(document.getElementById("testimonials"));Content Security Policy
If your site restricts scripts, the policy needs two things for the wall to load and draw:
script-srcallowshttps://sorak.app, where the script is served.connect-srcallowshttps://sorak.app, where the widget fetches the wall data.
style-src needs nothing for Sorak. The widget styles itself with a constructed stylesheet inside its Shadow DOM, which a policy does not count as an inline style, so a strict style-src 'self' is fine. Only browsers without constructed stylesheets (Safari before 16.4) fall back to a style element: under a strict policy they show the wall unstyled, with small stars and readable text, unless you add 'unsafe-inline'.
Content-Security-Policy:
script-src 'self' https://sorak.app;
connect-src 'self' https://sorak.app;
style-src 'self';The widget loads no images, fonts or frames. Its two links, Report and the badge, open in a new tab.
Isolation and safety
- The wall lives in an open Shadow DOM. Your CSS cannot restyle it, and its CSS cannot leak into your page.
- Testimonial text is set as plain text, never as HTML, so a testimonial cannot inject markup or script.
- The widget sets no cookies and stores nothing in the browser. It makes one request per wall.
- Every wall, on every plan, ends with a line saying the testimonials shown were approved by your business, and a Report link.
Accessibility
- The wall is a region labelled “Testimonials for” and your business name. Each testimonial is an
article. - The star rating is an image with the text “N out of 5 stars”. Initials in the avatar are hidden from screen readers.
- Dates use the
timeelement. Links have a visible focus ring. The loading animation stops for visitors who ask for reduced motion.
Troubleshooting
| What you see | Why, and what to do |
|---|---|
| Nothing appears and the div stays empty. | The slug is wrong or the space does not exist (the API answers 404), or the script could not load. The widget removes its own container on any failure and logs one console warning that starts with [sorak]. Open the browser console and the network tab. |
| The wall says “No testimonials yet”. | The space has no approved testimonials. Pending and rejected ones are never sent to the widget. |
| A testimonial I approved is missing. | The wall API is cached at the edge for up to 60 seconds. Wait a minute and reload. The widget shows the newest 200 at most. |
| A testimonial I rejected or deleted still shows. | Same cache: it leaves the wall within about 60 seconds. Rejecting or deleting never needs a redeploy of your site. |
| The wall does not show on my site: check Allowed websites. | On Pro, a list under Settings → Allowed websites limits the wall to those websites; any other page gets HTTP 403 and the console says the website is not on the list. Add the address your page is served from (www. is covered by the bare name), or clear the list. |
| The theme or accent did not change. | Dark theme and custom accent are Pro. A Free space always renders light with the default accent, whatever is saved in Settings. |
| The wall does not render inside my single-page app. | The widget mounts on page load. For content added later, call window.Sorak.mount(element) once the div is in the DOM. An element mounts once. |
| The console reports a Content Security Policy violation. | Allow the Sorak origin in script-src and connect-src. See the CSP section. |
| My site builder removes the script tag. | Use its custom-code or HTML-embed block, or load the script in the site's head or footer settings. Some builders strip scripts from rich-text fields. |
The wall data
The widget reads GET https://sorak.app/api/public/spaces/{slug}/wall, which answers with JSON and allows any origin, unless the space limits it to its allowed websites (then other origins get 403 {"error":"origin_not_allowed"}). It returns the space (slug, name, headline, accent, theme, showBadge) and the approved testimonials, newest first (id, authorName, authorTitle, rating, body, source, createdAt). An unknown slug answers 404. Automated scraping of this endpoint is outside fair use.