All integrations MapLibre Leaflet OpenLayers React Vue Svelte Angular React Native WordPress Webflow Squarespace Wix Shopify API docs

Add a map to your Wix site

Show customers where you are with an OpenStreetMap map in a Wix Embed HTML element. One extra step compared with other site builders: Wix runs embedded code on its own domain, so your key needs that domain too.

Before you start

  • A Wix site in the Wix Editor or Wix Studio. Wix's help pages list no plan requirement for the Embed HTML element (the separate "custom element" and site-wide Custom Code features are the ones that need a Premium plan and a connected domain). See Wix's Embedding a site or a widget article.
  • A free ExpressMaps API key. Sign up (no card), then copy a key from Console → Keys.
  • Your location as longitude and latitude. Use our map embed generator: drag and zoom to your address, double-click to drop the marker, and the numbers appear in the Latitude and Longitude boxes.

How Wix embeds work (and why it matters for your key)

Wix does not put your code straight into the page. It saves it as a small separate page on Wix's own file domain, filesusr.com, and shows that page inside a frame (an iframe). Each site gets its own address there, built from the site's domain with the dots turned into dashes, for example www-yourbusiness-com.filesusr.com.

This has two effects:

  • Your key sees Wix's domain, not yours. Requests for the map come from the filesusr.com address, so that is the domain the key restriction must allow. Adding only yourbusiness.com will block your own map.
  • The map fills a box you size in the editor. The snippet below sets the map to 100% of the frame, and you set the size by dragging the element's handles.

Step 1: Copy the Wix version of the code

This differs from our usual snippet only in the first few lines, which make the map fill the Wix frame edge to edge. Replace YOUR_API_KEY and the two sets of numbers. The order is longitude, then latitude: [-0.1276, 51.5072] is London.

<style>
  html, body { margin: 0; height: 100%; }
  #map { width: 100%; height: 100%; }
</style>
<link rel="stylesheet" href="https://unpkg.com/maplibre-gl@4.7.1/dist/maplibre-gl.css">
<script src="https://unpkg.com/maplibre-gl@4.7.1/dist/maplibre-gl.js"></script>
<div id="map"></div>
<script>
  var map = new maplibregl.Map({
    container: "map",
    style: "https://tiles.expressmaps.com/styles/standard.json?key=YOUR_API_KEY",
    center: [-0.1276, 51.5072],
    zoom: 13
  });
  map.addControl(new maplibregl.NavigationControl());
  new maplibregl.Marker()
    .setLngLat([-0.1276, 51.5072])
    .setPopup(new maplibregl.Popup().setText("Our shop"))
    .addTo(map);
</script>

Using the embed generator? Pick your style and position there, then copy the style address and the numbers into the snippet above, which is made to fill the Wix frame.

Step 2: Add an Embed HTML element

In the Wix Editor:

  1. Open the page where the map belongs and click Add Elements (the + on the left).
  2. Click Embed Code, then Popular Embeds, then Embed HTML.
  3. Click the new element on the page and click Enter Code.
  4. Make sure Code is selected (not Website address), paste the snippet under Add your code here, and click Apply.
  5. Drag the element's handles to the size you want, for example full width and about 400 pixels tall.
  6. Click Publish.

In Wix Studio the steps are the same, but the element is listed as Embed code under the Embed code section of the Add menu.

Check the result on the published site. Embeds can behave differently in the editor and in Preview.

Step 3: Find your Wix embed domain and restrict the key

First find the exact filesusr.com address Wix uses for your site:

  1. Open your published site in Chrome and go to the page with the map.
  2. Right-click inside the map area and choose View frame source. A new tab opens; its address starts with something like view-source:https://www-yourbusiness-com.filesusr.com/html/....
  3. The part between https:// and the next / is your embed domain, here www-yourbusiness-com.filesusr.com.

In Firefox, right-click the map and choose This Frame → Open Frame in New Tab instead, then read the address bar.

Then restrict the key:

  1. Go to Console → Keys and open your key.
  2. Under Key Restrictions, paste the embed domain (without https:// or anything after it) and click Add Restriction.
  3. Click Save Changes. It applies to new requests shortly after saving.

Add the embed domain exactly as you found it. Do not add plain filesusr.com: every Wix site's embeds live under that domain, so it would not protect your key. If you later connect a new domain to your Wix site, the embed address changes too, so check it again and update the key.

Using the same key on another website as well? Add that site's own domains to the same list, or better, create a separate key for each site so you can see their usage apart in the console.

Troubleshooting

  • An empty grey or white box. Almost always the key restriction. Make sure the filesusr.com embed domain from Step 3 is on the key's list, not just your own domain. To confirm, remove all restrictions for a minute: if the map appears, the restriction list is the problem.
  • The map is tiny or cut off. Keep the <style> lines at the top of the snippet, and resize the Embed HTML element itself; the map grows to fill it.
  • It worked, then stopped after connecting a domain. The embed domain changed. Repeat Step 3.
  • "filesusr.com refused to connect" or a security warning. Some office networks, ISPs or security tools block Wix's embed domain. It affects every Wix HTML embed, not just maps, and only visitors on that network.
  • The map is in the wrong place. Longitude and latitude are swapped. MapLibre wants [longitude, latitude].
  • Nothing shows on the mobile site. Check the element in the Wix mobile editor: it may be hidden on mobile, or sized very small.

Things to know

  • Is it really free? Yes. The free plan includes 100,000 map loads a month, commercial use allowed. One map load is one page view showing the map; panning and zooming are free.
  • Do I need a cookie banner for the map? Not for the map itself: the map sets no cookies and does not track visitors. Wix itself and other apps on your site may still need consent.
  • Why not Wix's built-in Google Maps element? It is fine for many sites. Use this method if you want one of our ten styles, or a map that sets no cookies.
  • Can I change the style? Replace standard in the style address with basic, enhanced, darklands, greyscale, navigator, subtle, autobahn, lithium or mulberry.
  • Can I show a second address? Yes, for a few locations copy the four new maplibregl.Marker() lines and change the numbers and popup text.
  • Page scrolling gets stuck on the map on phones. Add cooperativeGestures: true, after zoom: 13, so visitors move the map with two fingers and scroll the page with one.
  • Do I have to keep the "© OpenStreetMap" credit? Yes, the data licence requires it; the map adds it automatically.

Get a free API key Open the embed generator