Skip to main content
All CollectionsClick Actions
[PRO] Select Region by Default when page loads
[PRO] Select Region by Default when page loads
James avatar
Written by James
Updated over a week ago

To select a region by default on page load, you can add a small javascript code snippet to the custom JS field of the map.

// replace with your map ID and region code.
let mapUID = 236195;
let regionCode = 'US-CA';
let mapContainer = document.getElementById('map_' + mapUID);
mapContainer.addEventListener('mapready', function(ev) {
let urlParams = new URLSearchParams(window.location.search);
let myParam = urlParams.get('mregion');
if(!myParam){
setTimeout(function(){ iMapsManager.select(mapUID, regionCode) },500);
}
});

You’ll need to replace the mapUID code and regionCode to match your needs. This will simulate a click on that region when the map loads.

Consider that you can also set default content when using the click actions ‘display content below/next to the map’ by simply adding the content you want to display in the description field of the map.

Did this answer your question?