Browser SDK
The browser SDK runs in your pages. It tracks what visitors do, handles their consent and asks Rankrake for recommendations, which you render however you like.
Install
Section titled “Install”TODO docs: the script tag and the package, once the SDK’s distribution is decided.
Log in with the public key
Section titled “Log in with the public key”TODO docs: loginRankrake with the site’s public key; logoutRankrake, isRankrakeLoggedIn.
Consent
Section titled “Consent”TODO docs: the visitor starts as pending and nothing is recorded; grantConsent, revokeConsent,
getConsentState. Withdrawing erases what was stored.
Visits
Section titled “Visits”TODO docs: trackSessionStart, trackSessionStop, and identifying logged in users with
setUserIdentification / removeUserIdentification.
Clicks
Section titled “Clicks”TODO docs: trackClick on an item, and how a click on a recommended item carries the recommendation.
Recommendations
Section titled “Recommendations”TODO docs: makeRecommendationRequest (strategy, number of items, filters, the page’s item),
trackRecommendationShown when the block is visible, and rendering the items.
Cart and orders
Section titled “Cart and orders”TODO docs: trackAddToCart and trackPurchase (a whole order, sent as one event per line).
Sending before the page closes
Section titled “Sending before the page closes”TODO docs: forceFlush and the keepalive option.