Embedding

Script embed

One script tag, no build step, works on any site.

For sites that aren't React — WordPress, Astro, Hugo, plain HTML, anything.

<script src="https://api.vlozi.app/engagement/e/site_abc123/embed.js" defer></script>

The script finds elements by attribute, so you control the markup and your own CSS.

Attributes

Put data-vlozi-target on a container. Everything nested inside it inherits that target.

<article data-vlozi-target="post:post_abc123">
  <h1>How we cut our build time in half</h1>
 
  <span data-vlozi-views>—</span> views
 
  <div data-vlozi-reactions="like"></div>
  <div data-vlozi-comments></div>
</article>
Attribute
data-vlozi-target="post:<id>" marks the container; a view fires automatically
data-vlozi-views filled with the view count
data-vlozi-reactions="like,love" renders buttons for those kinds
data-vlozi-reactions="rating" renders stars
data-vlozi-comments renders the thread and form
data-vlozi-comments="readonly" thread with no form

Several targets on one page (an index, say) are batched into a single request.

Single-page apps

The script scans once when the page loads. After a client-side route change, tell it to scan again:

window.VloziEngage.mount();          // scan the whole document
window.VloziEngage.mount(container); // just this element

Styling

Everything the script renders carries a vlz-engage-* class and no inline styles beyond layout. Write your own CSS against those classes — nothing here fights you for specificity.

Collections entries

If you're already embedding a collection, its cards set data-vlozi-target for you. Add data-vlozi-engage to the mount container and load both scripts:

<div data-vlozi-collection="col_abc" data-vlozi-engage="reviews"></div>
 
<script src="https://api.vlozi.app/collections/c/embed.js" defer></script>
<script src="https://api.vlozi.app/engagement/e/site_abc/embed.js" defer></script>

reviews adds star ratings, helpful adds yes/no, all adds both. Off unless you ask — a collection of office locations doesn't need star ratings.

Engagement · EmbeddingEdit on GitHub