After two months of hard work, we are finally releasing an update for Maps and Locations extension. It was quite a lot of work but we were able to put so many features that I was considering naming this release 2.0 instead of 1.4.

The main goal of this update was to optimize Google Maps costs. As you probably now in the middle of 2018 Google started charging for Maps API usage and for the website which is heavily using the maps, the cost can add up fast.

Let’s start this article by explaining the charges applied by Google (as it’s hard to optimize without any reference), this will allows you to better understand how to strike a perfect balance between price and functionality.

How much does Google Maps API cost?

You start each month with a free $200 credit from Google. MAL is using two APIs:

  • JavaScript API (depending on your settings on Ad details pages and/or in [adverts_mal_map] shortcode) – this API is called when MAL renders a Dynamic Map. The cost is $7.00 per 1000 loads.
  • Autocomplete API (depending on your settings in [adverts_add] and/or in [adverts_list]) – this API is called when Google will autocomplete location for you. The cost is $2.83 per 1000 sessions. That is once page loads and user will start typing you will be charged once regardless of the number of suggestions.

If you are wondering how fast the free credits will be used, then it will last for roughly 28,000 map page views or 70,000 autocomplete suggestions.

Depending on where and how you are using the API even a small website can use the free credits in a matter of days (for example if the map on Ad details pages shows by default and you have [adverts_mal_map] on the homepage and you are using Google Autocomplete in the search form).

One the other side if you optimize the usage the free credits can last for a whole month while maintaining pretty similar functionality.

The MAL 1.4.0 has a few features that will allow you to cut down the map costs.

Integration with Open Street Maps

To avoid being charged for map loads we introduced integration with Open Street Maps. In the [adverts_mal_map] shortcode you can quickly switch between Google and Open Street maps by using js_engine param with value “osm” or “google”.

[adverts_mal_map] using the Open Street Maps (notice also the new design for infoboxes)

The integration with OSM has pretty much the same functionality like integration with Google Maps except for the integration with Category Icons extension. This is something we will be adding pretty soon.

You might be thinking “Uggh but the Open Street Maps are ugly“, to which i will reply:

  • “A” that is a matter of personal taste.
  • “B” with Open Street Maps you can use paid tiles providers like MapBox or OpenMapTiles to have a pretty design for the OSM maps (that will cost you though).

Optimize the dynamic maps costs yourself!

If you prefer using Google or some other paid tile provider note that you still can and should do some optimization yourself:

  • in wp-admin / Classifieds / Options / Maps and Locations panel and in field “Ad Details Page” / “Map Visibility” uncheck the “Map is visible by default” checkbox. Then you will be charged when the user will click on the “show map” button, not on every Ad detail page load.
  • do not use the [adverts_mal_map] on the homepage or even better show the normal [adverts_list] results first and only when the user will show interest in your Ads (for example by doing a search show him a map or link to the map).

Important Note. There is one catch here though. If you would like to use Google Autocomplete in the search and OSM for maps then this will be against the Google TOS. If you are using Google Autocomplete and want to show the results on a map it has to be a Google Map.

Improved Search

In the MAL 1.3 and earlier the location search for [adverts_list] had a quite a lot of options, unfortunately, only a few combinations made sense and even less generated quality results.

We started improving the search by modifying the configuration panel. First, the search options were narrowed based on how you enter the location in [adverts_add]. Second, the options which provided poor results were removed and the remaining ones were optimized.

Note. While we maintained backward compatibility with MAL 1.3 i highly recommend that you go to wp-admin / Classifieds / Options / Maps and Locations panel and review your settings. Even if it’s all ok click the “save” option just to make sure the new settings are being used and not the backward compatibility.

The dropdown and autocomplete inputs in the location search were replaced with a new interface optimized for large location databases and for mobile devices. It should make entering location a breeze.

New inerface for selecting, searching and suggesting locations.

Check out the video below to see how the options change when you start selecting options. Selecting how you enter the locations in [adverts_add] form will suggest you the best configurations for search:

Ok, Greg, that’s all cool, but what is the best MAL configuration?

I would recommend using the Google Autocomplete in the [adverts_add] when posting an Ad. It’s quite cheap and even if only 1 out of 10 users who will start posting an Ad will finish it, you can still have 7000 Ads posted for free each month.

In the [adverts_list] I recommend using the taxonomy dropdown and search by taxonomies. This will allow you to narrow the search results to a city. For the most common classifieds sites, it should be more than enough.

With this setup, you will be able to use only the free Google API limit and still have exact Ad locations, accurate search, and maps.

Aside from that remember to use the optimization tactics I described above in “Optimize the dynamic maps costs yourself!” section.

Integration with Authors extension

The Maps and Locations extension is now fully compatible with the Authors extension. What I mean by that is the Author registration and profile edit form will use the same MAL settings as [adverts_add] and the Authors search will use the same settings as [adverts_list].

Connecting [adverts_list] with [adverts_mal_map]

It is now possible to use the [adverts_list] and [adverts_mal_map] on a single page and have the [adverts_list] search affect the Ads shown on [adverts_mal_map] and vice versa. When you move the map the [adverts_list] results will be limited to the ones visible on map.

With just a bit of HTML and these two shortcodes, you can have map, list and search connection like in the video below

If you are thinking can i have a Google Jobs or AirBNB like functionality? then yes it is possible, but by using just the WPAdverts the design might not be that good. I am working on an experimental shortcode that will connect the map, list, and search form in a way that looks great and provides intuitive UX.

Since this is experimental functionality it will be released into the WPAdverts Snippets library and we will see if this is something users want and if it is then how to polish it.

Summary

That is over a 1000 words article now. We never had such long release notes, but i think the changes we are making here are important both for your wallet and the accuracy of the location search which is a must-have for small and medium classifieds site and the better you understand it the better you can implement it on your website.

Either way, the update is already available, if you cannot see it the, as usual, go to wp-admin / Dashboard / Updates panel and click “Check Again” button this should show you available update.

Remember to let me know in the comments how do you like the new MAL update?