Business policies
Display saved business policies using HTML attributes or retrieve them with JavaScript.
Business policies
Display saved business policies using HTML attributes or retrieve them with JavaScript. First, complete the installation.
Business policies
Display a saved policy from Settings → Business Policies without requiring customer sign-in. Install the Hosted Package with your Website SDK public key and configure your allowed website domains first.
Open the policy's … menu in settings and select Copy ID, then use that ID
as the value of data-tiquo-policy on a dedicated content element:
<section>
<h2>Terms of Service</h2>
<div data-tiquo-policy="terms-of-service"></div>
</section>| Built-in policy | ID |
|---|---|
| Refund Policy | refund-policy |
| Privacy Policy | privacy-policy |
| Terms of Service | terms-of-service |
For a custom policy, use its copied ID. Custom IDs stay the same when titles change. The public key determines which organisation's saved policies are returned.
The script replaces the element's contents with the policy content as plain text
and applies white-space: pre-wrap to preserve line breaks. HTML and Markdown are
not rendered as formatted content. Keep headings or other markup outside the bound
element, as shown above.
The script sets data-tiquo-policy-state after the request finishes:
| State | Meaning |
|---|---|
ready | The policy content has been displayed |
empty | The policy is unknown or has no non-whitespace content; the element is cleared |
error | The request failed; use Tiquo.render() to retry |
New elements inserted into the page are detected automatically. To reload saved
policies on an already rendered page, change a bound policy ID, or retry after a
failure, call Tiquo.render(). This also refreshes other supported attribute bindings.
For custom JavaScript rendering, both retrieval methods are available:
Tiquo.ready(async function (tiquo) {
try {
const { policies } = await tiquo.getPolicies();
const terms = await tiquo.getPolicy("terms-of-service");
console.log(policies, terms);
} catch (error) {
console.error("Unable to load business policies", error);
}
});getPolicies() returns { policies: [{ id, title, content }] }, omitting empty
policies. getPolicy(id) returns one policy or null. Both fetch saved data on each
call and reject if the request fails. displayPolicy() is a DOM Package helper;
use the HTML attribute above for automatic display with the Hosted Package.