Model Queries from Backend

One way of implementing LiftIgniter is using JavaScript SDK on the frontend to take care of sending user activities to us, and making model query requests from your backend to build the recommendation into the page (or even send us the inventory item instead of the JS scraping).

LiftIgniter Cookies

These are the cookies our JS SDK uses. You can extract them by referring to their cookie name, and attach it to the model query with the corresponding parameter names.

Make sure your codes are robust enough to handle the cases where the cookie doesn't exist. Because the cookie won't exist on user's first request to server.

Cookie NameQuery Parameter NameDescription
_iguserIdThis is the randomly generated UUID we use to identify a unique user. It's also used by our A/B test slicing, and you can change this value from the client side with the function $p("setUserId", "example_id").

This field will be empty if you have to make a recommendation to a user who has never entered this site before.
_igtsessionIdRandomly generated string to identify a unique session a user is in.
_igggidThis is a cross-site global user ID. It may not always be available. We recommend including it if available. It is necessary for some aspects of cross-site recommendations to work.

PageviewId and deduplication

As a best practice, you should include the pageviewId of the current page. This will give us accurate information tying the request to the pageview, and will also enable deduplication of recommendations between earlier and later requests. The function you can run in JavaScript to extract LiftIgniter's pageviewId is:

$p("getPageviewId");

Sending both userId and pageviewId allow us to deduplicate recommendations between queries that have the same pageviewId and userId (e.g., different areas on the same page).

Note however that we only deduplicate if the requests are made serially; we deduplicate between a request and previous completed requests, but we do not deduplicate between requests made in parallel. If you need to make multiple requests on the same userId and pageviewId in parallel and want deduplication, you should request more items than you need for each widget and handle the deduplication yourself.

If you are unable to send pageviewId (for instance, because you request recommendations before the LiftIgniter snippet executes), our recommendations will still work, but you will not be able to avail of within-page deduplication of recommendations, and some advanced analytics and diagnostics may be unavailable to you (however, all our main Analytics should continue to work normally).

Other Parameters

Following are the parameters that our JavaScript SDK collects, but aren't stored in the cookie. If you are making a query from backend you'll have to keep track most of these things yourself. However, this parameters are optional and aren't as important as the ones discussed above except for url field.

Query ParameterDescription
urlCurrent url that the user is on. This is an important field for knowing user's current context. If you have agreed to use some other field as content ID, then change the parameter name to whatever we agreed on.
referrerReferrer to the site. Potentially useful for you if you want to set a rule to certain recommendations (i.e. only show these types of recommendation for people coming in from facebook).
hostHost of client, so that we can infer appropriate recommendation from user's physical location.
userAgentUser agent of the user's computer.
osOperating system of the user.
languageUser's language.

An example query's parameter will look like the following:

{
  "apiKey" : "your api key here",
  "maxCount" : 10,
  "requestFields" : ["list","of","fields"],
  "requestFieldsAON" : true,
  "timestamp" : 1400464843310,
  "url" : "http://www.dummydomain.com/a-beautiful-sea.html",
  "userId" : "de305d54-75b4-431b-adb2-eb6b9e546013",
  "referrer" : "http://www.dummydomain.com/holiday-resorts.html"
}

For cross-site recommendations from backend, see the Cross-site recommendations from backend section at Cross-site recommendation.