Webflow sync, pageviews & more.
NEW

How can I add a custom map marker to Google Maps using Webflow?

TL;DR
  • Upload and host your custom marker image, then copy its direct URL.
  • Add an Embed element in Webflow, insert Google Maps API code with your API key, coordinates, and the custom icon URL, ensuring the map has a set height.
  • Publish your site and verify the marker displays correctly in the specified location.

To add a custom map marker to Google Maps in Webflow, you’ll need to embed custom JavaScript using an Embed element and include your marker’s image URL.

1. Prepare Your Custom Marker Image

  • Use a web-optimized image (e.g., PNG or SVG) for your marker icon.
  • Host it on Webflow (by uploading it via the Assets panel) or from a trusted external source.
  • Copy the direct URL to the image.

2. Add the Embed Element in Webflow

  • Drag an Embed component into your page layout where you want the map to appear.
  • Inside the Embed, paste the code to load the Google Maps JS API and initialize the map.

3. Insert Google Maps API Code with Custom Marker

  • Replace placeholders in the script with your own content:
  • Use your real Google Maps API key
  • Use your custom marker image URL
  • Set the latitude and longitude for your marker’s position

Here’s an example you can insert inside the Embed element:

<div id="map" style="width:100%; height:400px;"></div><script src="https://maps.googleapis.com/maps/api/js?key=YOUR_API_KEY"></script><script>  function initMap() {    var location = { lat: 40.7128, lng: -74.0060 }; // Example: New York City    var map = new google.maps.Map(document.getElementById('map'), {      zoom: 12,      center: location    });    var marker = new google.maps.Marker({      position: location,      map: map,      icon: 'https://yourdomain.com/path-to-custom-marker.png' // Replace with your custom icon URL    });  }  window.addEventListener('load', initMap);</script>
  • Replace YOUR_API_KEY with your actual Google Maps API key.
  • Replace the marker icon URL with your hosted image URL.

4. Set the Correct Styling

  • Ensure that #map in your code has a fixed height (like 400px) or it may not appear.
  • You can adjust this height using inline styles (as shown) or via a custom class in your Styles panel.

5. Publish and Test

  • Publish your Webflow site to view the embedded map live.
  • Check if the custom marker appears correctly at the desired location.

Summary

To add a custom map marker in Webflow, use an Embed element with Google Maps API code that sets a marker’s icon property to your marker’s image URL. Be sure to include your API key, coordinate values, and correct path to the custom icon.

Rate this answer

Other Webflow Questions