Skip to content

Embed on Website

There are three ways to add a Layota map to your website:

MethodBest for
Web ComponentClean HTML tag, events support, no build step
iframeSimplest possible embed
JavaScript SDKFull 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://layota.app/embed.js"></script>
<layota-map
  src="https://layota.app/embed/YOUR_PROJECT_ID"
  style="width: 100%; height: 600px;"
></layota-map>

Attributes

AttributeDescription
srcEmbed URL (required)
themelight, dark, blue, auto — override project theme
langLanguage code (e.g., en, ru)
loadercurrent, 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-uriURL 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.
forward-queryWhen present, forwards deep-link params (areaId, markerId, levelId, lang, theme) from the host page's URL into the map. Use for QR codes that point to your page with ?areaId=…. Explicit theme/lang attributes take precedence.
html
<layota-map
  src="https://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://layota.app/embed/YOUR_PROJECT_ID"
  custom-loader-uri="https://cdn.example.com/my-loader.gif"
  style="width: 100%; height: 600px;"
></layota-map>

Attributes are reactive and apply without a reload: changing theme, lang, or forward-query updates the map live. Only src (a different project) reloads 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). For programmatic SPA navigation (history.pushState), dispatch a popstate event or update an attribute on the element to trigger the update.

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://layota.app/embed/PROJECT_ID" style="width:100%;height:600px;"></layota-map>

<script src="https://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

EventDescription
areaClickUser clicked an area
areaHoverUser hovered over an area
areaFocusArea was focused
areaBookmarkUser bookmarked an area
markerClickUser clicked a marker
markerHoverUser hovered over a marker
markerInfoOpenMarker info card opened
floorChangeFloor switched
floorZoomFocusFloor zoom/focus changed
floorLoadFloor finished loading
routeRequestWayfinding route was requested
searchQueryUser searched
searchResultClickUser clicked a search result
searchNoResultsSearch returned no results
zoomChangeZoom level changed
panMoveMap was panned
componentLoadedMap component finished loading
componentUnmountedMap component was destroyed
interactionTimeTotal interaction time tracked

iframe

The simplest embed — one HTML tag, no JavaScript needed.

html
<iframe
  src="https://layota.app/embed/YOUR_PROJECT_ID"
  width="100%"
  height="600"
  frameborder="0"
  allow="fullscreen"
></iframe>

URL Parameters

https://layota.app/embed/PROJECT_ID?theme=dark&lang=en&levelId=floor-2&areaId=cafe
ParameterTypeDescription
themestringlight, dark, blue, auto
langstringLanguage code (e.g., en, ru)
loaderstringLoading animation shown until data arrives: current, stacked-squares, floor-plan, tile-shimmer, pin-drop, sliding-bar
customLoaderUristringURL of your own image/GIF to show as the loader (overrides loader); must be http(s)
levelIdstringLevel to show on load (id, key, or name)
areaIdstringArea to select on load (id, key, or title)
markerIdstringMarker to select on load (id, key, or title)
apiKeystringAPI key for domain-restricted projects

Responsive Sizing

html
<div style="position: relative; width: 100%; padding-bottom: 56.25%; height: 0;">
  <iframe
    src="https://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://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-sdk

Basic 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',
})

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.

Comparison

Web ComponentiframeJavaScript SDK
SetupScript tag + HTML tagOne HTML tagnpm install + code
Select entity on loadURL parameterURL parameterOption or method
Listen to eventsaddEventListenerNot possiblemap.on(...)
Select entity at runtimeforward-query URL (no reload)Change src (reloads)Method call (no reload)
Build routes at runtimeNot possibleNot possiblemap.buildRoute(...)
Fetch project dataNot possibleNot possiblemap.getProject()
Works without build stepYesYesCDN or npm
Shadow DOM isolationYesYes (iframe)No

Layota Documentation