Maps that wait for the consent of the visitor (consent="click"): the default placeholder, your own placeholder with Google Maps in the dark theme, and a map without consent. The button at the bottom withdraws the consent. See Consent (GDPR).
Template
{exp:reinos_maps:html_header}
{exp:reinos_maps:map width="100%" height="300px" consent="click"}
{maps:add_marker address="Utrecht Centraal"}
{/exp:reinos_maps:map}
{exp:reinos_maps:map width="100%" height="300px" consent="click" tiles="google_maps_roadmap" theme="dark"}
{maps:consent}
<strong>Google Maps</strong>
<p>This map comes from Google. <a href="/privacy">Privacy</a></p>
<button type="button" data-maps-consent-accept>Show the map</button>
{/maps:consent}
{maps:add_marker address="Domplein, Utrecht"}
{/exp:reinos_maps:map}
{exp:reinos_maps:map width="100%" height="300px"}
{maps:add_marker address="Amersfoort"}
{/exp:reinos_maps:map}
<button type="button" onclick="REINOS_MAPS.consent(false); location.reload()">Withdraw the consent</button>
<script>
document.addEventListener('maps:consent', function (event) {
console.log('The maps are loaded', event.detail);
});
</script>
{exp:reinos_maps:html_footer}Build it in your own site
What this example needs in ExpressionEngine, step by step.
- Install Maps.
- Put the code in a template.
This example comes from the Maps docs: the preview runs exactly the code above.