sdk.Leads.Tracker records a visitor's activity — viewing listings, searching, signing
up — onto their lead timeline in Rechat.
Tracking is tied to a lead: the tracker stores the lead's id in a cookie, and every
event is written to that lead's timeline. The cookie is set automatically whenever
sdk.Leads.capture() creates a lead, so in the common flow you
never manage it yourself. Tracking calls made before any lead is identified reject with
'No tracking id is found'.
const sdk = new Rechat.Sdk()
// After the visitor has been captured as a lead:
sdk.Leads.Tracker.viewedListing({
mls_number: '1841395151',
price: 1250000,
})
Each helper records one kind of activity. Listing events take a listing payload
({ id, url, mls, mls_number, price, property } — all optional); search events take a
search payload (price/bed/bath ranges, property_types, postal_codes, search,
url, title). Every helper accepts a final notes string for extra context.
| Method | Records that the visitor… |
|---|---|
viewedListing(listing, notes?) |
viewed a listing |
sharedListing(listing, notes?) |
shared a listing |
favoritedListing(listing, notes?) |
favorited a listing |
removedFavoriteListing(listing, notes?) |
removed a favorite |
valuedListing(listing, notes?) |
requested a valuation |
searchedListings(search, notes) |
searched for listings |
createdSearch(search, notes) |
saved a search |
removedSearch(search, notes) |
removed a saved search |
signedUp(notes?) |
signed up |
loggedIn(notes?) |
logged in |
For anything else, use the low-level capture({ action, listing?, search?, notes? })
with a custom action name.
If you already have a lead id (for example from your own backend), point the tracker at it directly:
sdk.Leads.Tracker.identify(leadId)
const sdk = new Rechat.Sdk({
tracker: {
cookie: {
name: 'my-awesome-tracker', // default: 'rechat-sdk-tracker'
options: { maxAge: 60 * 60 * 24 * 365 }, // standard cookie serialize options
}
}
})
Set tracker: false in the SDK settings to stop capture() from identifying new
leads. This does not remove a previously set cookie — to erase it and stop tracking the
current visitor, call:
sdk.Leads.Tracker.stop()