![](http://flink.com.au/sites/default/files/styles/large/public/field/image/View%20Order%20Locations_0.jpg?itok=fS_l6I1E)
Today we tackle another real-life example of use-cases in the area of location based services (LBS). The question recently posed to us was this: knowing that Drupal's IP Geolocation module is great at retrieving and mapping location information, can we channel its power to analyse where purchases from our online store originate from, compared from one season to next?
The answer is: yes we can. And here is how.
Our starting point is a Drupal install with IP Geolocation (7.x-1.5 or later), Views (7.x-3.x) and Commerce enabled.
The aim is to map the locations of orders placed at the store, filtered by time period. For this we take advantage of a recent feature of IP Geolocation, which is the mapping of any view (as in the Views module), provided that view outputs at least latitude and longitude fields (or fields re-labelled that way). Lat/long coordinates are sufficient to place a marker on the map for each order. Any remaining order information from the view (e.g. order number, order state, buyer's IP and street address etc.) will be displayed in the marker balloon pop-up when a user (if authorised) clicks the marker. To make things even easier IP Geolocation comes with an “Order Locations” view, which you can customise to your heart's content. The default format, the new option "Map (via IP Geolocations)", has already been set for you. Use the page display at /order-locations or push the view (i.e. map) into a block.
And there you have it: a snazzy map of the origins of the latest purchases made at your store.
[By the way, if this is the first time you've installed IP Geolocation, then visit its configuration page to update the backlog of past visitors' IP address information.]
As with any view, you can add filters too, e.g. order status, time range, country...
Working nicely and in well under 60 seconds. See the screenshot...
Happy analysing buyers locations!
Comments
This is great, guys! Thanks
This is great, guys! Thanks for sharing. : )