Recommendation

Recommendation Use Cases

Get one store or list all stores around Woosmap estimated user position

Find the closest point of sale from the user

Someone visiting a foreign city could access your website application that allows users to search where he can find your store. Using the Woosmap Recommendation, the Web application has access to nearest assets from the user’s approximate position and it is therefore able to rank the returned assets by proximity to the user’s location.

Take a little Coffee Break

loader

The getUserRecommendation(GetRecommendationOptions) returns a successCallback with stores nearby the user estimated position. Please, check the GetRecommendationOptions object Specification to see how to use this method in details.

<script src="https://recommendation-js.woosmap.com/recommendation.js"></script>
<script>
(function (publicKey) {
   woosmapRecommendation.setProjectKey(publicKey);
   woosmapRecommendation.getUserRecommendation({
        successCallback: function (stores) {
            if (stores && stores.features && stores.features.length > 0){
                console.log("Recommended Store Found", stores.features[0]) 
            }
        },
        limit: 1
   });
})('woos-XXXX-YYYY')
</script>

The string woos-XXXX-YYYY should be replaced with your Woosmap Project Public Key. According to the API Reference, the successCallback function is called when the automatic recommendation succeed. The retrieved assets features are given as callback argument. As we decided to limit the returned assets to 1, there is only one store returned for this sample.

Display the three nearest assets from the user

Someone visiting a foreign city could access your website application that allows users to search where he can find your assets. Using the Woosmap Recommendation, the Web application has access to nearest assets from the user’s approximate position and it is therefore able to rank the returned assets by proximity to the user’s location.

Find the three nearest Coffee Shops

loader

How to Implement the Feature

The only differences are the limit property that changed from 1 to 3 when calling the woosmapRecommendation.getUserRecommendation().

function updateStoreListWithRecommendation() {
    woosmapRecommendation.getUserRecommendation({
        successCallback: updateStoreList,
        limit: 3
    });
}