
The following guide will walk you through how to integrate Mappedin’s Responsive Web App with your website.
Read more about Mappedin Web at https://www.mappedin.com/wayfinding/web-app/
Mappedin Web is a fully packaged solution that can be easily embedded into your website by following this simple guide. Once it's configured, you will have ongoing access to the Mappedin Web platform as it continuously evolves and improves with new features and data driven learnings. Customers using Mappedin Web will always have the best version of our product, with out of the box features including:
- An interactive 3D map
- Location search and category listing
- Turn by turn directions
- A details page for each location including deals, photo gallery, external links, and related locations
- A mobile first, app centric, responsive design
- Deep linking support
... and more.
Prerequisites
Before embedding Mappedin Web, please ensure the following requirements have been met
- Venue is fully mapped and tested (demo links will be provided to preview the front-end experience)
- Location data is up to date and ready for production
- Mappedin venue keys have been provided to you
1. Integration
Mappedin will provide credentials and specific instructions, but at a high level you just need a HTML element, Javascript configuration, and an external stylesheet.
Place the following external stylesheet in your <head>
:
<link href="https://d1p5cqqchvbqmy.cloudfront.net/web2/release/mappedin-web.css" rel="stylesheet" />
and include the following JavaScript snippet in the <body>
:
<div data-key="<probably externalId, or skip>" id="mappedin-map"></div>
<script type="text/javascript"> window.mappedin = { miKey: { id: "<your credentials>", key: "<your credentials>", }, venue: "<your venue here>", language: "<default language code>" }</script>
<script type="module" src="https://d1p5cqqchvbqmy.cloudfront.net/web2/release/mappedin-web.js"></script>
The map expands to the maximum allowed size based on the parent div
of the #mappedin-map
element. Positioning and sizing that element for desktop and mobile, will ensure that the map is displayed correctly.
You can also specifiy the source of the data that is loaded onto Mappedin Web. There is a separate draft environment on the Mappedin CMS, where users can make changes, updates or conduct testing without affecting live production data. By default, production data is always loaded, however, you can point the app to load draft data by setting, the optional property, window.mappedin.useDraftData = true
in the previous snippet.
<script type="text/javascript"> window.mappedin = { // other values from before useDraftData: true } </script>
We also support specifying links for your privacy policy, terms of use, cookie policy and cookie settings if you'd like to configure them. These are always visible on the app. You can specify them either as strings, or you can specify a callback that will be called when the link is clicked. To set these up, you can use the following properties:
<script type="text/javascript"> window.mappedin = { // other values from before legal: { termsOfUse: 'https://info.mappedin.com/privacy-policy', privacyPolicy: () => alert('Privacy policy callback'), cookiePolicy: 'https://example.com', cookieSettings: () => { console.log('Cookie settings callback function can do whatever you want') } } } </script>
These are all optional properties. As long as one is specified, the appropriate link(s) will be displayed.
2. Language
If you wish to display different languages for Mappedin Web, you can specify the language via the language
property in the JavaScript configuration object. Whatever is set in the snippet will be the language set on initial load - if no language is set it will default to English. You may also want to set the language
property dynamically from outside Mappedin Web so that you can translate the website where it is embedded while also translating the app’s UI at the same time.
You can access the language property directly like this: window.mappedin.language = "fr"
.This configuration needs to be set before the external mappedin script loads.
Currently supported languages include:
- English (en)
- Arabic (ar)
- Catalan (ca)
- Czech (cs)
- Danish (da)
- Dutch (nl)
- Estonian (et)
- Finnish (fi)
- French (fr)
- German (de)
- Greek (el)
- Hindi (hi)
- Hungarian (hu)
- Italian (it)
- Japanese (ja)
- Korean (ko)
- Norwegian (no)
- Portuguese (pt)
- Romanian (ro)
- Russian (ru)
- Slovak (sk)
- Spanish (es)
- Spanish - US (es-US)
- Swedish (sv)
- Tagalog (tl)
- Turkish (tr)
- Ukrainian (uk)
- Vietnamese (vi)
- Chinese Simplified (zh-CN)
As we continously improve these translations, we welcome your feedback during your integration review process.
3. Requirements
It is embedded as a web component not an iFrame. It utilizes the shadow dom to hold the necessary HTML, meaning it can co-exist with the rest of your site but not be affected by your CSS styling. To ensure the best experience across mobile and desktop, it will work best if your site is already designed to be responsive. On desktop, Mappedin Web can have the rest of your site surrounding it, though we recommend you let the map take up as much space as possible (up to nearly a full screen map experience if you want). On mobile, Mappedin Web will fill the screen and provide its own toolbar on the bottom for a scroll-free, app centric experience.
There are some specific details for integration that should be taken into account:
- Wrap Mappedin Web in its own container. This container should be styled to take up the whole screen on mobile (<1024) and fit into your responsive layout on desktop views.
- On desktop, the minimum width of the container should be 1024px
- On mobile, do not include any more page content than the header and the map; things like footers and other content should be excluded or hidden.
- If the host site utilizes hash navigation, Mappedin Web must live on a static page to not interfere.
4. Recommendations
These are not required, but to get the best possible experience there are a few extra steps that can be taken:
- Allow the map to take up as much space as possible on mobile and desktop
- On mobile, avoid adding too many elements that will decrease the vertical space available for Mappedin Web (this is especially noticeable on smaller devices like the iPhone SE
- Use a one column layout
- Use a traditional responsive style (CSS media queries, not JavaScript)
- If your Location data is being synced in to our system, you can specify
data-key="externalId"
on the<key>
to use your own Ids in the URL and for deep linking Tabs to show categories and info already in Mappedin Web are redundant - Avoid including unnecessary functionality on the map page that could impact load times of Mappedin Web
You can view how an integration should look via the demo page provided for your venue(s). We recommend the integration follow the demo experience.
5. Deep Linking
Mappedin Web offers a way to link directly to many pages. The following represents all of the deep linking routes that are possible, with a description of what it will do and any parameters you will need. You can see these in action by simply using the map and watching the URL. You can then copy and use those URLs directly, or use the list below to make your own.
The URL will display the value type set with data-key
in the snippet. All of the values given in the URL need to be URL encoded e.g. space in a name should become %20
.
5.1 Location Page
/profile?location=<locationId | locationName | externalId>
locationId
: Mappedin ID of the location to displaylocationName
: Name of the location to displayexternalId
: External ID of the location to display
Using any of the above will deep link to a specific location.
5.2 Categories Page
/categories
List all available categories
5.3 Specific Category Page
/categories?category=<categoryName | categoryId | externalId>
categoryName
: Name of the category to displaycategoryId
: Mappedin internal id of the category to displayexternalId
: External ID of the category
Display a category page using one of the above identifiers. Defaults to show the name of the category in the URL.
5.4 Search Page
/search
Display the search form
5.5 Directions Page
/directions
Directions page
5.6 Directions - From Page
/directions?from=<fromId | fromName | fromExternalId>
fromId
,fromName
,fromExternalId
: Preset departure point to display directions page with a preset from field
5.7 Directions - To Page
/directions?to=<toId | toName | toExternalId>
toId
,toName
,toExternal
: Preset arrival point to display directions page with a preset to field
5.8 Directions - From/To Page
/directions?to=<to>&from=<from>&accessible=true&textDirectionsVisible=true
from
: (Location ID, Name or External ID) Preset departure pointto
: (Location ID, Name or External ID) Preset destination point
Optional:
accessible
: Default:false
, can set this param to true to enable directions that will prioritize elevators and rampstextDirectionsVisible
: Default:false
, can set this param to true to show text directions alongside the wayfinding path upon initial load
Full-page integration example
This example shows how to integrate Mappedin Web v2 as a standalone page instead of inserting it in an existing page with other content.
Frequently Asked Questions
Which browsers are supported?
Mappedin Web v2 supports the recent versions of the major web browsers listed below. Some older version may work, however they are not supported.
- Chrome
- Edge
- Firefox
- Safari
- No IE support
I have followed the above guide, including the styles and the snippet but the map is not visible
This can often be caused by a parent <div>
not having a height. The map fills the height and width available to it, so please make sure that any wrapper or parent divs have an adequate height set. To see if this is the issue, modify the parent div
in the browser's developer tools to have the following attributes:
position: relative;height: 1000px;
The map element is obstructed on mobile (Safari) by the URL bar
On mobile it's important to give the map as much space as possible for the best user experience. If the map is relatively positioned on mobile, and height is based on viewport and not a full screen height (i.e. 80vh), the map can be obstructed by the title bar of the browser. This mostly happens on Safari and there are several ways around this. Matt Smith on his blog Allthingssmitty suggests adding min-height: -webkit-fill-available;
to the element where the height is set. CSS Tricks uses Javascript to calculate a custom viewport height value and then set an additional height value on the element, keeping the old one as a fallback if a browser doesn’t support CSS variables:
function recalculateHeight() { document.documentElement.style.setProperty('--vh', (window.innerHeight / 100) + 'px');}
window.addEventListener('resize', recalculateHeight);recalculateHeight();
element { height: calc(100vh - 100px); height: calc(calc(100 * var(--vh)) - 100px);}
What domains need to be included in our CSP?
Mappedin Web must be able to access the following domains via your website. Please ensure they are allowed in your Content Security Policy.
*.cloudfront.net
s3.amazonaws.com
*.s3.amazonaws.com
*.mappedin-cloud.com
*.mappedin.com
*.blob.core.windows.net
Is it possible to disable mouse scrolling on the map?
Unfortunately not as some of the functionality requires scrolling to work. We highly recommend having the map on a page with as little else as possible. This ensure a better user experience especially on mobile devices where the map should have as much screen real estate as possible.
How can I integrate Mappedin Web v2 into my Angular application?
This StackOverflow post has several answers explaining different integration methods of dynamic scripts into an Angular application. As shown in the snippet above, you'll need:
- Import styles with
@import url("https://d1p5cqqchvbqmy.cloudfront.net/web2/release/mappedin-web.css");
in your module CSS-file. window.mappedin
object with appropriate information on the page.- The target HTML element
<div data-key="externalId" id="mappedin-map"></div>
. - Then load
mappedin-web.js
dynamically.
How to fix conflicting behavior on mobile when pulling down to minimize store profile?
If Mappedin Web is integrated to be a full page integration or an integration where the map is entirely visible without scrolling the page, the pull down action on the store profile could interfere with mobile browsers’ “Pull down to Refresh” functionality. Disable “Pull to Refresh” functionality of the browser with the following CSS:
body,html { overscroll-behavior-y: contain;}
The application UI is very small on mobile devices
To scale the UI properly on mobile devices, Mappedin Web v2 requires the following meta tag in your <head>
:
<meta name="viewport" content="width=device-width, initial-scale=1.0" charset="UTF-8" />
The search bar takes over the whole screen on mobile devices
Please check that your page sets the <!DOCTYPE html>
, <head>
and <body>
tags. These are required by the application to be display and function correctly. Have a look at the full page integration example for more detailed code sample.