{"id":119,"date":"2025-12-15T10:46:48","date_gmt":"2025-12-15T07:46:48","guid":{"rendered":"https:\/\/mapsfun.com\/?p=119"},"modified":"2025-12-15T10:46:48","modified_gmt":"2025-12-15T07:46:48","slug":"how-to-add-google-maps-to-wix-website","status":"publish","type":"post","link":"https:\/\/mapsfun.com\/?p=119","title":{"rendered":"How to Add Google Maps to Wix Website"},"content":{"rendered":"\n<h2 class=\"wp-block-heading\">How to Add a Custom Map with Multiple Locations to Your Wix Site<\/h2>\n\n\n\n<p>Displaying multiple locations \u2014 like storefronts, event venues, or service areas\u2014on your Wix website is a common need. While Wix has a built-in map element, it&#8217;s primarily designed for showing a single address. Creating a custom, multi-location map requires a workaround. This guide will show you the manual method using Wix&#8217;s Velo code and the Google Maps API.<\/p>\n\n\n\n<p><strong>This method is powerful and fully customizable, but it requires a Google Cloud account, enabling paid APIs, and writing JavaScript code within Wix.<\/strong><\/p>\n\n\n\n<p class=\"has-text-align-center\"><strong>Method 1: Using Wix Velo and the Google Maps API (The &#8220;Developer&#8221; Way)<\/strong><\/p>\n\n\n\n<p class=\"has-text-align-left\">This approach gives you full control over the map&#8217;s look and functionality but involves several technical steps.<\/p>\n\n\n\n<p class=\"has-text-align-center\"><strong>Step 1: Prepare Your Google Cloud Project<\/strong><\/p>\n\n\n\n<p>Before touching Wix, you need to set up access to Google&#8217;s mapping services.<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>1<strong>.&nbsp; Go to the [Google Cloud Console](<a href=\"https:\/\/console.cloud.google.com\/\">https:\/\/console.cloud.google.com\/<\/a>).<\/strong><\/li>\n<\/ul>\n\n\n\n<figure class=\"wp-block-image size-large is-resized\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"534\" src=\"https:\/\/mapsfun.com\/wp-content\/uploads\/2025\/12\/image-11-1024x534.png\" alt=\"\" class=\"wp-image-121\" style=\"width:696px;height:auto\" srcset=\"https:\/\/mapsfun.com\/wp-content\/uploads\/2025\/12\/image-11-1024x534.png 1024w, https:\/\/mapsfun.com\/wp-content\/uploads\/2025\/12\/image-11-300x157.png 300w, https:\/\/mapsfun.com\/wp-content\/uploads\/2025\/12\/image-11-768x401.png 768w, https:\/\/mapsfun.com\/wp-content\/uploads\/2025\/12\/image-11-1536x802.png 1536w, https:\/\/mapsfun.com\/wp-content\/uploads\/2025\/12\/image-11.png 1600w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><\/figure>\n\n\n\n<ul class=\"wp-block-list\">\n<li>2.&nbsp; <strong>Create a new project and enable billing<\/strong>. Don&#8217;t worry\u2014Google offers a $200 monthly credit, which is more than enough for most small to medium websites.<\/li>\n\n\n\n<li>3.  <strong>Enable the Necessary APIs:<\/strong> Navigate to &#8220;APIs &amp; Services &gt; Library&#8221; and enable these two:\n<ul class=\"wp-block-list\">\n<li>Maps JavaScript API<\/li>\n\n\n\n<li>Geocoding API (to convert addresses into coordinates)<\/li>\n<\/ul>\n<\/li>\n\n\n\n<li>4.&nbsp; <strong>Create an API Key:<\/strong> Go to &#8220;APIs &amp; Services &gt; Credentials&#8221; and click &#8220;Create Credentials &gt; API key&#8221;.<\/li>\n\n\n\n<li>5.&nbsp; <strong>Crucially, Restrict Your API Key:<\/strong> For security, restrict the key to the <strong>Maps JavaScript API<\/strong> and your website&#8217;s domain (e.g., `<strong>https:\/\/yourusername.wixsite.com\/yoursite<\/strong>` and your custom domain).<\/li>\n<\/ul>\n\n\n\n<p><strong>Enabling the necessary APIs in Google Cloud Console.*<\/strong><\/p>\n\n\n\n<figure class=\"wp-block-image size-large is-resized\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"322\" src=\"https:\/\/mapsfun.com\/wp-content\/uploads\/2025\/12\/image-12-1024x322.png\" alt=\"\" class=\"wp-image-122\" style=\"width:661px;height:auto\" srcset=\"https:\/\/mapsfun.com\/wp-content\/uploads\/2025\/12\/image-12-1024x322.png 1024w, https:\/\/mapsfun.com\/wp-content\/uploads\/2025\/12\/image-12-300x94.png 300w, https:\/\/mapsfun.com\/wp-content\/uploads\/2025\/12\/image-12-768x242.png 768w, https:\/\/mapsfun.com\/wp-content\/uploads\/2025\/12\/image-12.png 1046w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><\/figure>\n\n\n\n<p class=\"has-text-align-center\"><strong>Step 2: Add the Map Container to Your Wix Page<\/strong><\/p>\n\n\n\n<p>1.&nbsp; In the Wix Editor, go to the page where you want the map.<\/p>\n\n\n\n<p>2.&nbsp; Click <strong>Add (+) &gt; More &gt; HTML Code<\/strong>.<\/p>\n\n\n\n<p>3.&nbsp; Drag the &#8220;<strong>HTML iframe<\/strong>&#8221; element onto your page and resize it to your preferred dimensions. You don&#8217;t need to paste any code into the element&#8217;s settings yet. This box will act as the container for your map.<\/p>\n\n\n\n<p><strong>Adding an HTML iframe element to a Wix page.<\/strong><\/p>\n\n\n\n<p class=\"has-text-align-center\"><strong>Step 3: Use Wix Velo to Inject the Map Code<\/strong><\/p>\n\n\n\n<p>This is the most technical part. You&#8217;ll use Wix&#8217;s development environment to write code that &#8220;injects&#8221; the Google Map into the HTML box.<\/p>\n\n\n\n<p>1.&nbsp; In the Wix Editor, click <strong>Dev Mode &gt; Enable Dev Mode<\/strong>.<\/p>\n\n\n\n<p>2.&nbsp; Click <strong>Public &amp; Backend<\/strong> in the site menu to open the code editor.<\/p>\n\n\n\n<p>3.&nbsp; In your page&#8217;s code (e.g., `<strong>home.js<\/strong>`), add the following JavaScript. Replace `<strong>YOUR_API_KEY<\/strong>` with the key you generated in Step 1.<\/p>\n\n\n<pre class=\"wp-block-code\" aria-describedby=\"shcb-language-1\" data-shcb-language-name=\"PHP\" data-shcb-language-slug=\"php\"><span><code class=\"hljs language-php\">$w.onReady(<span class=\"hljs-function\"><span class=\"hljs-keyword\">function<\/span> <span class=\"hljs-params\">()<\/span> <\/span>{\n    <span class=\"hljs-comment\">\/\/ The ID of your HTML iframe element. You can find this in the Properties panel.<\/span>\n    <span class=\"hljs-keyword\">const<\/span> htmlComponent = $w(<span class=\"hljs-string\">'#html1'<\/span>); \n\n    <span class=\"hljs-comment\">\/\/ Your list of locations: &#91;Name, Address]<\/span>\n    <span class=\"hljs-keyword\">const<\/span> locations = &#91;\n        &#91;<span class=\"hljs-string\">'New York Office'<\/span>, <span class=\"hljs-string\">'350 5th Ave, New York, NY 10118'<\/span>],\n        &#91;<span class=\"hljs-string\">'Brooklyn Warehouse'<\/span>, <span class=\"hljs-string\">'55 Water St, Brooklyn, NY 11201'<\/span>],\n        &#91;<span class=\"hljs-string\">'Central Park Kiosk'<\/span>, <span class=\"hljs-string\">'Central Park, New York, NY'<\/span>]\n    ];\n\n    <span class=\"hljs-comment\">\/\/ Function to geocode an address and return its Lat\/Lng<\/span>\n    <span class=\"hljs-function\"><span class=\"hljs-keyword\">function<\/span> <span class=\"hljs-title\">geocodeAddress<\/span><span class=\"hljs-params\">(address)<\/span> <\/span>{\n        <span class=\"hljs-keyword\">const<\/span> geocoder = <span class=\"hljs-keyword\">new<\/span> google.maps.Geocoder();\n        <span class=\"hljs-keyword\">return<\/span> <span class=\"hljs-keyword\">new<\/span> Promise((resolve, reject) =&gt; {\n            geocoder.geocode({ <span class=\"hljs-string\">'address'<\/span>: address }, (results, status) =&gt; {\n                <span class=\"hljs-keyword\">if<\/span> (status === <span class=\"hljs-string\">'OK'<\/span>) {\n                    resolve(results&#91;<span class=\"hljs-number\">0<\/span>].geometry.location);\n                } <span class=\"hljs-keyword\">else<\/span> {\n                    reject(<span class=\"hljs-string\">'Geocode failed: '<\/span> + status);\n                }\n            });\n        });\n    }\n\n    <span class=\"hljs-comment\">\/\/ Initialize the map once all addresses are geocoded<\/span>\n    Promise.all(locations.map(location =&gt; geocodeAddress(location&#91;<span class=\"hljs-number\">1<\/span>])))\n        .then(coordinates =&gt; {\n            <span class=\"hljs-comment\">\/\/ Create the HTML and JavaScript for the map<\/span>\n            <span class=\"hljs-keyword\">const<\/span> mapHtml = `\n                &lt;!DOCTYPE html&gt;\n                &lt;html&gt;\n                &lt;head&gt;\n                    &lt;style&gt;<span class=\"hljs-comment\">#map { height: 100%; width: 100%; }&lt;\/style&gt;<\/span>\n                &lt;\/head&gt;\n                &lt;body&gt;\n                    &lt;div id=<span class=\"hljs-string\">\"map\"<\/span>&gt;&lt;\/div&gt;\n                    &lt;script src=<span class=\"hljs-string\">\"https:\/\/maps.googleapis.com\/maps\/api\/js?key=YOUR_API_KEY\"<\/span>&gt;&lt;\/script&gt;\n                    &lt;script&gt;\n                        <span class=\"hljs-keyword\">const<\/span> map = <span class=\"hljs-keyword\">new<\/span> google.maps.Map(document.getElementById(<span class=\"hljs-string\">'map'<\/span>), {\n                            zoom: <span class=\"hljs-number\">10<\/span>,\n                            center: { lat: <span class=\"hljs-number\">40.7128<\/span>, lng: <span class=\"hljs-number\">-74.0060<\/span> } <span class=\"hljs-comment\">\/\/ Default center (NYC)<\/span>\n                        });\n\n                        <span class=\"hljs-comment\">\/\/ Add markers for each location<\/span>\n                        <span class=\"hljs-keyword\">const<\/span> locations = ${JSON.stringify(locations)};\n                        <span class=\"hljs-keyword\">const<\/span> coordinates = ${JSON.stringify(coordinates)};\n\n                        coordinates.<span class=\"hljs-keyword\">forEach<\/span>((coord, i) =&gt; {\n                            <span class=\"hljs-keyword\">new<\/span> google.maps.Marker({\n                                position: coord,\n                                map: map,\n                                title: locations&#91;i]&#91;<span class=\"hljs-number\">0<\/span>]\n                            });\n                        });\n\n                        <span class=\"hljs-comment\">\/\/ Adjust map bounds to show all markers<\/span>\n                        <span class=\"hljs-keyword\">const<\/span> bounds = <span class=\"hljs-keyword\">new<\/span> google.maps.LatLngBounds();\n                        coordinates.<span class=\"hljs-keyword\">forEach<\/span>(coord =&gt; bounds.extend(coord));\n                        map.fitBounds(bounds);\n                    &lt;\/script&gt;\n                &lt;\/body&gt;\n                &lt;\/html&gt;\n            `;\n\n            <span class=\"hljs-comment\">\/\/ Post the HTML to the iframe<\/span>\n            htmlComponent.postMessage(mapHtml);\n        })\n        .<span class=\"hljs-keyword\">catch<\/span>(error =&gt; console.error(error));\n});\n<\/code><\/span><small class=\"shcb-language\" id=\"shcb-language-1\"><span class=\"shcb-language__label\">Code language:<\/span> <span class=\"shcb-language__name\">PHP<\/span> <span class=\"shcb-language__paren\">(<\/span><span class=\"shcb-language__slug\">php<\/span><span class=\"shcb-language__paren\">)<\/span><\/small><\/pre>\n\n\n<p>This code does the following: it takes your list of addresses, converts them to coordinates using the Google Geocoding API, and then generates a full Google Map with markers, which it sends to the HTML iframe on your page.<br><\/p>\n\n\n\n<p class=\"has-text-align-center\"><strong>The Challenges with This Wix Velo Method<\/strong><\/p>\n\n\n\n<p>As you can see, this process is <strong>not for the faint of heart<\/strong><\/p>\n\n\n\n<p>* &nbsp; <strong>Technical Overhead: <\/strong>You need to manage a <strong>Google Cloud account and billing<\/strong>, which can be intimidating for non-developers.<\/p>\n\n\n\n<p>* &nbsp;<strong> Complex Code:<\/strong> The solution requires a solid understanding of <strong>JavaScript, Promises, and the Google Maps API<\/strong>.<\/p>\n\n\n\n<p>* &nbsp; <strong>Wix-Specific Quirks:<\/strong> Using `postMessage` to communicate with an HTML iframe is a specific workaround for Wix&#8217;s environment.<\/p>\n\n\n\n<p>* &nbsp; <strong>Limited Design Control: <\/strong>Customizing the map&#8217;s design (colors, marker icons) requires even more complex code changes.<\/p>\n\n\n\n<p class=\"has-text-align-center\"><strong>There&#8217;s a Much Simpler, Codeless Solution: <a href=\"http:\/\/mapsfun.com\">MapsFun.com<\/a><\/strong><\/p>\n\n\n\n<p>Why spend hours wrestling with API keys and complex code when you can achieve a better result in minutes?<\/p>\n\n\n<p><iframe src=\"https:\/\/panel.mapsfun.com\/embed-map?code=668ecbcced7931f89205d1e881bb82aa&#038;lang=uk&#038;tpl=photo\" width=\"100%\" height=\"600\" style=\"border:0\" loading=\"lazy\" referrerpolicy=\"no-referrer-when-downgrade\"><\/iframe><\/p>\n\n\n\n<p><a href=\"http:\/\/mapsfun.com\"><strong>MapsFun.com<\/strong><\/a><strong> is built specifically for this purpose. It completely bypasses the need for Google Cloud and Velo coding.<\/strong><\/p>\n\n\n\n<p>1.&nbsp; <strong>Truly No-Code:<\/strong> Simply use the intuitive visual editor to search for locations and add them to your map with a click.<\/p>\n\n\n\n<p>2.&nbsp; <strong>No API Keys or Billing:<\/strong> We handle all the backend complexity. You just design your map.<\/p>\n\n\n\n<p>3.&nbsp; <strong>Rich Customization:<\/strong> Easily choose from different map styles, add custom icons for different location types, and design beautiful pop-up info windows\u2014all through a user-friendly interface.<\/p>\n\n\n\n<p>4.&nbsp;<strong> Seamless Wix Integration:<\/strong> Once your map is perfect, you just copy the embed code and paste it into the same Wix <strong>HTML iframe<\/strong> element. No custom code required.<\/p>\n\n\n\n<p>Stop the struggle with Velo and Google Cloud. Create a beautiful, professional, multi-location map in minutes and embed it on your Wix site effortlessly with <a href=\"http:\/\/mapsfun.com\">MapsFun.com<\/a>.<\/p>\n","protected":false},"excerpt":{"rendered":"How to Add a Custom Map with Multiple Locations to Your Wix Site Displaying multiple locations \u2014 like storefronts, event venues, or service areas\u2014on your Wix website is a common need. While Wix has a built-in map element, it&#8217;s primarily designed for showing a single address. Creating a custom, multi-location map requires a workaround. This [&hellip;]","protected":false},"author":2,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[16,1],"tags":[],"class_list":["post-119","post","type-post","status-publish","format-standard","hentry","category-map-wix","category-1"],"_links":{"self":[{"href":"https:\/\/mapsfun.com\/index.php?rest_route=\/wp\/v2\/posts\/119","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/mapsfun.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/mapsfun.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/mapsfun.com\/index.php?rest_route=\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/mapsfun.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=119"}],"version-history":[{"count":6,"href":"https:\/\/mapsfun.com\/index.php?rest_route=\/wp\/v2\/posts\/119\/revisions"}],"predecessor-version":[{"id":203,"href":"https:\/\/mapsfun.com\/index.php?rest_route=\/wp\/v2\/posts\/119\/revisions\/203"}],"wp:attachment":[{"href":"https:\/\/mapsfun.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=119"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/mapsfun.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=119"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/mapsfun.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=119"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}