Recommendation Reference
Recommendation Javascript API Reference- Recommendation class
- FeatureCollection object Specification
- GetPositionOptions object Specification
- GetRecommendationOptions object Specification
- PaginationObject object Specification
- PostPOIPositionOptions object Specification
- PostPositionOptions object Specification
- SearchStoresOptions object Specification
- SuccessCallback function definition
- consentCallback function definition
- woosmapRecommendation object Specification
Recommendation class 🔗
Recommendation
Constructor | |
Recommendation( |
Constructs a new Recommendation |
Methods | |
setProjectKey( |
Sets the project key. This method should always be called before any others. |
optIn( |
Sets the user as opted in. This method should be called before using user profiled methods, but after project key has been set. |
optOut( |
Sets the user as opted out. This method should be called before using user profiled methods, but after project key has been set. |
sendUserBillingPosition( |
POST a billing position for the user. |
sendUserHtml5Position( |
POST an html5 position for the user. |
sendUserBeaconPosition( |
POST an beacon position for the user. |
sendUserSearchedPosition( |
POST an searched position for the user. |
sendUserShippingPosition( |
POST a shipping position for the user. |
sendUserShippingPOI( |
POST a shipping POI position for the user. |
sendUserConsultedPOI( |
POST a consulted POI position for the user. |
sendUserFavoritedPOI( |
POST a favorited POI position for the user. |
sendCtaEvent( |
POST a CTA event for the user. |
getUserRecommendation( |
GET the user recommendation. |
searchStores( |
GET Search stores. |
getUserPosition( |
GET the user position (in lat/lng). |
getConsent( |
When ready, returns the current status of user consent |
FeatureCollection object Specification 🔗
Properties | |
pagination |
Type: PaginationObject
Pagination informations |
type |
Type: String
Will always be “FeatureCollection” |
features |
Type: Array.<Stores>
The stores list |
GetPositionOptions object Specification 🔗
Properties | |
successCallback? |
Type: Function
Function call if the GET request is a success (code == 2**). Callback parameter could be :
|
errorCallback? |
Type: Function
Function call if the GET request is an error (code != 2**). |
GetRecommendationOptions object Specification 🔗
Example
var getRecommendationOptions = {
successCallback: getRecommendationSuccessCallback,
limit: 10,
maxDistance: 50000,
query: '(tag:"tag1" and tag:"tag2") or type: "type1"'
};
Properties | |
successCallback? |
Type: SuccessCallback
Function call if the GET request is a success (code == 2**) |
errorCallback? |
Type: Function
Function call if the GET request is an error (code != 2**). |
limit? |
Type: Number
The number of stores returned by the recommendation API (min: 1, max:100, default: 5) |
maxDistance? |
Type: Number
radius in meters to filter the stores from the user’s supposed location |
query? |
Type: String
a query to filter returned stores |
zone? |
Type: Boolean
returns only stores that possess a zone intersecting with the user position. |
PaginationObject object Specification 🔗
Properties | |
page |
Type: Number
The current page number |
pageCount |
Type: Number
The number of page available. |
PostPOIPositionOptions object Specification 🔗
Properties | |
lat |
Type: Number
The latitude of the position. |
lng |
Type: Number
The longitude of the position. |
id |
Type: String
The id of the POI |
successCallback? |
Type: Function
Function call if the POST request is a success (code == 2**). |
errorCallback? |
Type: Function
Function call if the POST request is an error (code != 2**). |
PostPositionOptions object Specification 🔗
Properties | |
lat |
Type: Number
The latitude of the position. |
lng |
Type: Number
The longitude of the position. |
successCallback? |
Type: Function
Function call if the POST request is a success (code == 2**). |
errorCallback? |
Type: Function
Function call if the POST request is an error (code != 2**). |
SearchStoresOptions object Specification 🔗
Example
var getStoresOptions = {
successCallback: successCallback,
page: 2,
storesByPage: 10,
lat: 43.3,
lng: 3.883,
maxDistance: 50000,
query: '(tag:"tag1" and tag:"tag2") or type: "type1"'
};
Properties | |
successCallback? |
Type: SuccessCallback
Function call if the GET request is a success (code == 2**). |
errorCallback? |
Type: Function
Function call if the GET request is an error (code != 2**). |
maxDistance? |
Type: Number
radius in meters to filter the stores from the user’s location |
query? |
Type: String
a query to filter returned stores |
storesByPage? |
Type: Number
The number of stores returned by the API for each page (min: 1, max: 300, default: 100) |
page? |
Type: Number
The page number of the stores returned by the API (default: 0) |
lat? |
Type: Number
the Latitude |
lng? |
Type: Number
the Longitude |
zone? |
Type: Boolean
returns only stores that possess a zone intersecting with the passed coordinates. |
SuccessCallback function definition 🔗
SuccessCallback
Function | function(featureCollection:FeatureCollection|Object) |
Success call back for stores recommendation or search. Returns FeatureCollections with or without features. When recommending stores, if user position is unknown, returns empty object. |
consentCallback function definition 🔗
consentCallback
Function | function(consent:Boolean) |
Get Consent callback |
woosmapRecommendation object Specification 🔗
The global woosmapRecommendation
You should not instantiate Recommendation object. Instead you could access a recommendation object using the global woosmapRecommendation
woosmapRecommendation.setProjectKey('your_project_key');