Appearance
Embed on Website
There are three ways to add a Layota map to your website:
| Method | Best for |
|---|---|
| Web Component | Clean HTML tag, events support, no build step |
| iframe | Simplest possible embed |
| JavaScript SDK | Full programmatic control, routing, data access |
Web Component
The recommended way to embed a map. Drop in a script tag and use <layota-map> as a regular HTML element.
html
<script src="https://app.layota.app/embed.js"></script>
<layota-map
src="https://app.layota.app/embed/YOUR_PROJECT_ID"
style="width: 100%; height: 600px;"
></layota-map>Attributes
| Attribute | Description |
|---|---|
src | Embed URL (required) |
theme | light, dark, blue, auto — override project theme |
lang | Language code (e.g., en, ru) |
loader | current, stacked-squares, floor-plan, tile-shimmer, pin-drop, sliding-bar — loading animation shown until the map data arrives. Set it to match your project's loader so the right animation appears instantly (the project's own setting is only known after the data request completes). Omit it to show nothing during the initial request. |
custom-loader-uri | URL of your own image/GIF to show as the loader. Hosted by you, so it appears instantly. Overrides loader. Must be an http(s) URL. |
search | bar, button, hidden — this embed's search bar, whatever the project's Appearance says. See Controls per embed |
zoom-controls | visible, hidden — this embed's zoom buttons |
language-switcher | visible, hidden — the visitor's language button above the zoom buttons (shown only when the project has two or more languages) |
share-button | visible, hidden — the Share button on a place's card and next to a built route |
first-view | fit, fill — how this embed first opens: the whole plan, or the plan scaled to fill the block. Without it the project's First view |
view | 2d, 3d — the view this embed opens in, when the project has 3D on. Without it such a map opens in 3D. The visitor can still switch if the project shows the 2D / 3D button |
analytics | off — visits to this embed are not counted in the project's analytics. See Visits that are not counted |
forward-query | When present, forwards deep-link params (areaId, markerId, levelId, lang, theme, tags, from, to, mode, view, analytics) from the host page's URL into the map. Use for QR codes and email links that point to your page with ?areaId=… or a route ?from=…&to=…. Explicit theme/lang attributes take precedence. |
loading | eager (default) loads the map straight away. Set loading="lazy" to defer loading until the map is scrolled near the viewport (native iframe lazy-loading) — useful when the map sits far below the fold and you want to save the request until it's needed. |
html
<layota-map
src="https://app.layota.app/embed/YOUR_PROJECT_ID"
theme="dark"
lang="en"
loader="sliding-bar"
style="width: 100%; height: 600px;"
></layota-map>Use your own loader image instead of a built-in animation:
html
<layota-map
src="https://app.layota.app/embed/YOUR_PROJECT_ID"
custom-loader-uri="https://cdn.example.com/my-loader.gif"
style="width: 100%; height: 600px;"
></layota-map>Controls per embed
One map can look different on each page of your site: the full map with search on the "Site map" page, a clean one in a small block on the home page. search, zoom-controls, language-switcher and share-button set the controls of this embed only, whatever the project's Appearance says:
html
<!-- Home page: a small map without search and zoom buttons -->
<layota-map
src="https://app.layota.app/embed/YOUR_PROJECT_ID"
search="hidden"
zoom-controls="hidden"
style="width: 100%; height: 320px;"
></layota-map>| Attribute | Values | Without it |
|---|---|---|
search | bar — the full search bar · button — a search icon that opens the bar · hidden | The project's Appearance |
zoom-controls | visible · hidden | The project's Appearance |
language-switcher | visible · hidden — the visitor's language button above the zoom buttons | The project's Appearance |
share-button | visible · hidden — the Share button on cards and routes; hide it on a kiosk | The project's Appearance |
first-view | fit — the whole plan · fill — the plan fills the block, with no empty bands. Read when the map loads | The project's First view |
Hiding search keeps the place cards and routes: a visitor still taps a place to open its card and build a route from it. A map narrower than 640 px (on a phone, say) always shows search as a full-width bar, so button looks like bar there. The language button appears only when the project has two or more languages, whatever the attribute says. The same values work as URL parameters of an iframe (?search=hidden&zoomControls=hidden&languageSwitcher=hidden&shareButton=hidden) and as the SDK's ui option. A value the map doesn't know is ignored — the project's setting stays — and reported to your page: <layota-map> fires an ERROR event, the SDK an error event.
Attributes are reactive and apply without a reload: changing theme, lang, search, zoom-controls, language-switcher, share-button, view, or forward-query updates the map live. Remove search, zoom-controls, language-switcher or share-button to go back to the project's setting. Only src (a different project) and analytics reload the iframe; loader / custom-loader-uri affect just the initial load.
With forward-query, the map also follows the host page's URL as the visitor navigates (back/forward) — a changed ?from= / ?to= redraws the route and a changed ?tags= sets the legend filter (a URL without it clears the filter) without a reload. For programmatic SPA navigation (history.pushState), dispatch a popstate event or update an attribute on the element to trigger the update.
Share button
The map has a Share button in two places: on a place's card, right of its name, and in the route panel, right of Build route once a route is drawn. A guest who found pitch 74 — or the way from reception to the pool — sends it to their family; your reception copies it into a booking confirmation.
The button offers a link, a QR code of the same link, or both — you choose in Appearance → Share Button. With both on (the default) it opens a small menu of the two; with one it acts at once. One of the two is always on.
- Link, phones and tablets: the system share sheet opens (WhatsApp, Messages, Mail).
- Link, desktop: the link is copied and the button says "Link copied". Where the browser refuses both, the link is shown selected, to copy by hand.
- QR code: the code takes the place of the card (or of the route panel), to scan with another phone — handy at a reception desk or on a kiosk. Download under the code saves it as a PNG, to print or to send. Closing it brings the card or the panel back.
The link opens your page. With <layota-map> the shared link is the address of the page the map sits on, so the guest lands on your own site with the map on that place or route:
| Your embed | A shared link looks like |
|---|---|
<layota-map forward-query> | https://your-site.com/map?areaId=… or ?from=…&to=… — the same deep-link params |
<layota-map> without forward-query | https://your-site.com/map?layota=areaId%3D… — the place or route travels in one layota param, which the element always reads. Your page's own params are left alone |
A plain <iframe>, the full-page map | The map's own address, https://app.layota.app/embed/PROJECT_ID?areaId=… |
Nothing to set up: embed.js tells the map which page it is on and gives the iframe leave to share and copy (allow="web-share; clipboard-write"). For a plain <iframe>, add that allow attribute yourself so the share sheet and the clipboard work; without it the link is still offered to copy by hand.
A link names a place by its key (?areaId=pitch-74) when it has one, else by its id — give places a key and shared links stay short and readable. On a map with two or more languages the link carries lang — the language the visitor reads the map in — so whoever opens it reads the same (an explicit lang attribute on your <layota-map> still wins, as for any link). It carries mode for a route on a map with more than one route mode. analytics=off and other test parameters never travel.
Turn the button off for the whole project in Appearance → Share Button, or for one embed with share-button="hidden". Each share fires a SHARE event on the element and, with analytics on, is counted as share.
Events
The web component dispatches CustomEvents that you can listen to. Events are only fired when analytics is enabled for the project and the specific event is turned on in project settings.
html
<layota-map id="map" src="https://app.layota.app/embed/PROJECT_ID" style="width:100%;height:600px;"></layota-map>
<script src="https://app.layota.app/embed.js"></script>
<script>
const map = document.getElementById('map')
map.addEventListener('areaClick', (e) => {
console.log('Clicked area:', e.detail)
})
map.addEventListener('markerClick', (e) => {
console.log('Clicked marker:', e.detail)
})
map.addEventListener('floorChange', (e) => {
console.log('Floor changed:', e.detail)
})
</script>Available Events
| Event | Description |
|---|---|
areaClick | User clicked an area |
areaHover | User hovered over an area (dispatched to your page only — not recorded in Layota analytics) |
areaFocus | Area was focused |
areaBookmark | User bookmarked an area |
markerClick | User clicked a marker |
markerHover | User hovered over a marker (page only, as above) |
markerInfoOpen | Hovering showed a marker's tooltip (page only, as above) |
floorChange | Floor switched |
floorZoomFocus | Floor zoom/focus changed |
floorLoad | Floor finished loading |
routeRequest | Wayfinding route was requested |
searchQuery | User searched |
searchResultClick | User clicked a search result |
filterApply | Visitor toggled a legend category (active tag ids and matched count) |
searchNoResults | Search returned no results |
zoomIn | Zoom-in button pressed |
zoomOut | Zoom-out button pressed |
zoomChange | Zoom level changed by wheel or pinch |
panMove | Map was panned |
languageSwitch | Visitor switched the map's language with the language button |
viewSwitch | Visitor switched between 2D and 3D with the map's button (from, to: 2d / 3d) |
share | Visitor shared a place or a route with the Share button (kind, id / from, to, mode, method) |
componentLoaded | Map component finished loading |
componentUnmounted | Map component was destroyed |
interactionTime | Total interaction time tracked |
These map events fire always, whatever the analytics settings; e.detail carries their data:
| Event | e.detail | When |
|---|---|---|
READY | { projectId } | The map is loaded and accepts commands |
LANGUAGE_CHANGE | { language } | The map's language changed — the visitor's language button, the lang attribute or the SDK |
ROUTE_BUILT | { route, levelId } | A route from a route link (or a BUILD_ROUTE command) was drawn; levelId is its start level |
ROUTE_NOT_FOUND | {} | No route between the two places |
SHARE | { kind: 'place', placeType, id, url, method } or { kind: 'route', from, to, mode?, url, method } | The visitor used the Share button. placeType is area or marker; url is the link; method is native (share sheet), clipboard (copied), manual (shown to copy by hand) or qr (shown as a QR code). id / from / to are ids; url uses keys where places have them |
ERROR | { message } | Something the map could not apply, e.g. an attribute value it doesn't know |
ERROR | { code: 'load_failed', message, status?, canRetry } | The map could not load: not published (status 404), not allowed on this domain (403), the API key is not valid (401), too many requests (429), a server error (5xx), or no answer (no status). No READY follows, and the commands sent to the map so far are dropped. canRetry: the visitor's card offers Reload |
iframe
The simplest embed — one HTML tag, no JavaScript needed.
Only /embed/{id} is allowed inside a third-party frame. Every other page of the app sends frame-ancestors 'self', so pointing an iframe at the editor or dashboard renders nothing.
html
<iframe
src="https://app.layota.app/embed/YOUR_PROJECT_ID"
width="100%"
height="600"
frameborder="0"
allow="fullscreen"
></iframe>URL Parameters
https://app.layota.app/embed/PROJECT_ID?theme=dark&lang=en&levelId=floor-2&areaId=cafe
# Open with the legend filter applied (tag names or ids, comma-separated)
https://app.layota.app/embed/PROJECT_ID?tags=comfort,huisdieren| Parameter | Type | Description |
|---|---|---|
theme | string | light, dark, blue, auto |
lang | string | Language code (e.g., en, ru) |
loader | string | Loading animation shown until data arrives: current, stacked-squares, floor-plan, tile-shimmer, pin-drop, sliding-bar |
customLoaderUri | string | URL of your own image/GIF to show as the loader (overrides loader); must be http(s) |
levelId | string | Level to show on load: id, key, or the level's default name (case-insensitive, e.g. ?levelId=Floor%202). A level inside a building (drill-down) opens with the building's floors in the switcher and a way back |
areaId | string | Area to select on load, with its card open (id, key, or title) |
markerId | string | Marker to select on load, with its card open (id, key, or title) |
from | string | Start of a route to open with — an area or marker on any level (id, key, or title). See Route in a link |
to | string | Destination of a route to open with (id, key, or title) |
mode | string | How that route is travelled: walk, drive or stepfree (wheelchair, stroller). Without it the project's default route mode. See Route in a link |
tags | string | Legend filter to open with, comma-separated: tag names (case-insensitive, any project language — ?tags=comfort) or tag ids. A name shared by two tags matches both; an unknown value is skipped and reported as an SDK error |
search | string | This embed's search bar: bar, button, hidden. See Controls per embed |
zoomControls | string | This embed's zoom buttons: visible, hidden |
languageSwitcher | string | The visitor's language button above the zoom buttons: visible, hidden |
shareButton | string | The Share button on cards and routes: visible, hidden |
firstView | string | How the map first opens: fit (the whole plan) or fill (the plan fills the block) |
view | string | 2d or 3d: the view the map opens in, when the project has 3D on |
analytics | string | off — this visit is not counted in analytics |
apiKey | string | API key for domain-restricted projects |
Route in a link
from and to open the map with a route — no code on your page. Put the link in a booking confirmation, print it as a QR code at an entrance, or add it to a meeting invite.
# The route from reception to pitch 74, drawn on load
https://app.layota.app/embed/PROJECT_ID?from=reception&to=pitch-74
# A QR code at the north entrance: the route starts here, the visitor picks where to
https://app.layota.app/embed/PROJECT_ID?from=entrance-north
# A meeting invite: the visitor picks where they start
https://app.layota.app/embed/PROJECT_ID?to=room-214
# A booking confirmation at an RV park: the way the RV drives to its site
https://app.layota.app/embed/PROJECT_ID?from=entrance&to=site-64&mode=drive| Link | What opens |
|---|---|
from + to | The route drawn, on its start level and fitted to the screen. The route builder shows both ends |
to only | The route builder with the destination filled in |
from only | The route builder with the start filled in |
mode picks how the route is travelled: walk (on foot), drive (by car: along the roads, one-way roads as drawn, then on foot where only a path goes on) or stepfree (wheelchair, stroller: no steps, no stairs or escalators). Without it the route uses the project's Default route mode (Wayfinding panel); an unknown value is ignored. A link may ask for a mode the map doesn't offer in its route builder; the route is still built in it. If there is no way in that mode, the map shows the way on foot, with On foot selected in the route builder. See route modes.
Each end is found on any level by its id, its key (the Key (Slug) field of the area or marker, e.g. pitch-74), or its title in any of the project's languages (?to=Pitch%2074; case and accents don't matter). Keys are the safest choice: they don't change when you rename a place. A name that matches nothing is ignored and the map opens as usual; from / to take precedence over areaId / markerId.
Wayfinding must be enabled for the project; without it a route link opens the card of the place it names (the destination when it names two) instead of the route builder. Embedded with the web component and forward-query, your page's own URL can carry the route (https://your-site.com/map?from=reception&to=pitch-74). The map posts ROUTE_BUILT or ROUTE_NOT_FOUND to the page, like buildRoute() does.
Responsive Sizing
html
<div style="position: relative; width: 100%; padding-bottom: 56.25%; height: 0;">
<iframe
src="https://app.layota.app/embed/PROJECT_ID"
style="position: absolute; top: 0; left: 0; width: 100%; height: 100%;"
frameborder="0"
allow="fullscreen"
></iframe>
</div>Full-Page Embed
html
<iframe
src="https://app.layota.app/embed/PROJECT_ID"
style="position: fixed; top: 0; left: 0; width: 100%; height: 100%; border: none;"
allow="fullscreen"
></iframe>JavaScript SDK
For full programmatic control — select areas, build routes, fetch project data.
Install
bash
npm install @layota/map-sdkBasic Usage
html
<div id="map" style="width: 100%; height: 600px;"></div>
<script type="module">
import { LayotaMap } from '@layota/map-sdk'
const map = new LayotaMap({
container: '#map',
projectId: 'YOUR_PROJECT_ID',
})
await map.ready()
</script>With Options
typescript
const map = new LayotaMap({
container: '#map',
projectId: 'YOUR_PROJECT_ID',
apiKey: 'sk_...',
theme: 'dark',
language: 'en',
levelId: 'floor-2',
areaId: 'cafe',
// or open with a route: from: 'reception', to: 'pitch-74'
ui: { search: 'button', zoomControls: 'hidden' }, // this embed's controls
})Interact with the Map
typescript
await map.ready()
// Select and zoom to an area
map.selectArea('coffee-shop').focusOn('coffee-shop')
// Listen to events
map.on('areaClick', (area) => {
console.log('Clicked:', area.title)
})
// Build a route
map.buildRoute(
{ id: 'entrance', type: 'area', levelId: 'floor-1' },
{ id: 'cafe', type: 'area', levelId: 'floor-2' }
)
// Clean up
map.destroy()For the full API reference, see JavaScript SDK. For framework-specific examples, see React / Vue and iOS / Android.
When the Map Does Not Load
When the map cannot be shown, a card in its place says Couldn't load the map — in the map's language (the lang of the embed, otherwise the visitor's browser language). Under the title one line says why; it is written for whoever set the map up, and is not translated:
| The line under the title | What it means | Reload button |
|---|---|---|
| This map isn't available. It may have been unpublished or removed. | The project id in the embed code is wrong, or the project is not published (a draft, unpublished, archived) | — |
| This map isn't allowed on this domain. Check the project's Allowed Domains setting. | The page is not in the project's allowed domains and the embed carries no API key | — |
| The API key in this embed is not valid or has been disabled. | The embed carries an apiKey that was deleted, is mistyped, or was switched off because the plan no longer includes API keys. A map without allowed domains does not need a key at all — remove it from the embed code | — |
| Write API keys cannot be used in embeds. … | The embed code carries a write key; create a read key for it | — |
| Too many people are opening maps from this network right now. Please try again in a minute. | More maps were opened from one network address in a minute than the rate limit allows. A short wait the map sits out by itself and tries again; it says so when the wait would be long | yes |
| (no line) | The request got no answer — the visitor is offline, or the connection dropped | yes |
The card has a Reload button where loading again can help; where only a change of the embed code or of the project helps, it has none.
Your page hears it too: <layota-map> fires an ERROR event with e.detail.code === 'load_failed' and the same line as message (see Events); with the SDK, ready() rejects with a LayotaMapLoadError (Lifecycle).
Comparison
| Web Component | iframe | JavaScript SDK | |
|---|---|---|---|
| Setup | Script tag + HTML tag | One HTML tag | npm install + code |
| Select entity on load | URL parameter | URL parameter | Option or method |
| Open with a route | URL parameter (from / to) | URL parameter (from / to) | Option or method |
| Listen to events | addEventListener | Not possible | map.on(...) |
| Select entity at runtime | forward-query URL (no reload) | Change src (reloads) | Method call (no reload) |
| Build routes at runtime | forward-query URL (no reload) | Change src (reloads) | map.buildRoute(...) |
| Show / hide search, zoom, language and Share buttons | search / zoom-controls / language-switcher / share-button attributes (no reload) | URL parameter | ui option, map.setUi(...) |
| Shared links open | Your page | The map's own address | The map's own address |
| Fetch project data | Not possible | Not possible | map.getProject() |
| Works without build step | Yes | Yes | CDN or npm |
| Shadow DOM isolation | Yes | Yes (iframe) | No |