To avoid delaying the rendering of your page, the script can be loaded asynchronously, with the async or defer attribute. Since the script then does not run at its position in the page, the data-dom-target attribute is required to specify the element in which the map is inserted. The element can be placed anywhere in the page, before or after the script tag.
<div id="aqi-map"></div>
<script async src="https://aqicn.org/maplet/embed.v1.js"
data-city="paris"
data-dom-target="aqi-map"
data-height="450"></script>
Result:
Loading the script from javascript
The script can also be inserted dynamically, for instance from a tag manager or a single page application. The same data-dom-target rule applies:
<div id="aqi-map"></div>
<script>
var s = document.createElement("script");
s.src = "https://aqicn.org/maplet/embed.v1.js";
s.setAttribute("data-city", "london");
s.setAttribute("data-dom-target", "aqi-map");
document.head.appendChild(s);
</script>