Recommendation Reference

Recommendation Javascript API Reference
  1. Recommendation class
  2. FeatureCollection object Specification
  3. GetPositionOptions object Specification
  4. GetRecommendationOptions object Specification
  5. PaginationObject object Specification
  6. PostPOIPositionOptions object Specification
  7. PostPositionOptions object Specification
  8. SearchStoresOptions object Specification
  9. SuccessCallback function definition
  10. consentCallback function definition
  11. woosmapRecommendation object Specification

Recommendation class 🔗


Recommendation

Constructor
Recommendation()

Constructs a new Recommendation


Methods
setProjectKey(projectKey:String)

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(postPositionOptions:PostPositionOptions)

POST a billing position for the user.

sendUserHtml5Position(postPositionOptions:PostPositionOptions)

POST an html5 position for the user.

sendUserBeaconPosition(postPositionOptions:PostPositionOptions)

POST an beacon position for the user.

sendUserSearchedPosition(postPositionOptions:PostPositionOptions)

POST an searched position for the user.

sendUserShippingPosition(postPositionOptions:PostPositionOptions)

POST a shipping position for the user.

sendUserShippingPOI(postPositionOptions:PostPOIPositionOptions)

POST a shipping POI position for the user.

sendUserConsultedPOI(postPositionOptions:PostPOIPositionOptions)

POST a consulted POI position for the user.

sendUserFavoritedPOI(postPositionOptions:PostPOIPositionOptions)

POST a favorited POI position for the user.

sendCtaEvent()

POST a CTA event for the user.

getUserRecommendation(getRecommendationOptions:GetRecommendationOptions)

GET the user recommendation.

searchStores(getStoresOptions:SearchStoresOptions)

GET Search stores.

getUserPosition(getPositionOptions:GetPositionOptions)

GET the user position (in lat/lng).

getConsent(consentCallback:consentCallback)

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 :

  • An empty object if there is no position know for the user

  • The recommended position as {"latitude": "x", "longitude": "y"}

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');