Recommendation

Contributing

How to contribute to Woosmap Recommendation

Contribute to Recommending API Profiles

In order to build profiles and benefit from the recommendation, every implementation must contribute to collecting location data through users’ digital journey.

Synchronous and Asynchronous

Like described in the Loading topic, use the corresponding method depending on how you loaded the recommendation.js script.

//Synchronous
woosmapRecommendation.sendUserHtml5Position({lat: 43, lng: 3.3});

//Asynchronous
rRequestQueue.push(['sendUserHtml5Position', [{lat: 43, lng: 3.3}]]);

Contributing Use Cases

Google Geocoding API

Below is a sample HTML and Javascript code to allow your visitor to geocode an address. The resulted position will be pushed to Woosmap Profile using woosmapRecommendation.sendUserSearchedPosition()

<input type="text" name="query" id="queryinput" placeholder="Search an Address">
<input type="submit" id="search-geocoding">
<script>
function geocodeAddress(geocoder) {
    var address = document.getElementById('queryinput').value;
    geocoder.geocode({'address': address}, function (results, status) {
        if (status === google.maps.GeocoderStatus.OK) {
            var latitude = results[0].geometry.location.lat();
            var longitude = results[0].geometry.location.lng();
            //Contribute to Woosmap Profile
            woosmapRecommendation.sendUserSearchedPosition({
                lat: latitude,
                lng: longitude,
                successCallback: function () {
                    // finally, search the assets around your location
                    searchWoosmapApiAroundLocation(latitude, longitude);
                }
            });
        } else {
            console.log('Geocode was not successful: ' + status);
        }
    });
}
function init() {
    var geocoder = new google.maps.Geocoder();
    document.getElementById('search-geocoding').addEventListener('click',
        function () {
            geocodeAddress(geocoder);
        });
}
</script>
<script src="https://maps.googleapis.com/maps/api/js?key=API_KEY&callback=init">
</script>

HTML5 Geolocation API

The Geolocation API, natively supported by modern browsers, defines a high-level interface to location information associated only with the device hosting the implementation, such as latitude and longitude. Here is a Javascript sample to plug this feature to your website and contribute to Woosmap profiles on success callback using woosmapRecommendation.sendUserHtml5Position().

// Acquire a new position object.
navigator.geolocation.getCurrentPosition(successCallback, errorCallback);

function successCallback(position) {
    //Contribute to Woosmap Profile
    woosmapRecommendation.sendUserHtml5Position({
        lat: position.coords.latitude,
        lng: position.coords.longitude,
        successCallback: function () {
            // finally, search the assets around your location
            searchWoosmapApiAroundLocation(latitude, longitude);
        }
    })
}

function errorCallback(error) {
    console.log(error.code)
}

Other Use Cases

You are able to contribute in many other instances like posting the user billing position or a shipping position. Please refer to the API Reference for an exhaustive list of all the ways such contributing could be posted.

Privacy Requirements

Woosmap takes privacy very seriously. In order to be compliant with standard reglementation on data privacy, a website using Woosmap Recommendation must add to its privacy policy the following mention:

  • Used cookies: Location cookie
  • Description: This cookie is generated by all our websites, mobile websites and mobile applications by a tierce company, Web Geo Services, to collect location data. These data are used by our websites, services or other Web Geo Services’ customers to provide you advanced functionalities such as automatic store or pickup point proximity, with opening schedule.
  • Duration: According to the regulation, this cookie has a 13 months life time. Past this time, your consent will be asked again to add a new cookie.
  • Processing: Location data are processed by Web Geo Services to develop Geo-location segments and profiles in order to bring you advanced location functionalities on website you browse on.
  • Recipient: [Company Name] is the only recipient of those processed data, limited to the data collected from our websites or applications.
  • Information: You can access and ask for rectification on data collected by contacting Web Geo Services – Services consommateurs – 19, rue de la République 34000 Montpellier, France or [email protected]
  • Opposition: You can, for legitimate motivations, ask to be excluded of the data collection by opting out at this address: https://www.woosmap.com/policies/privacy/