SDK API reference
identify, track, consent, and the handful of other calls you may need.
Most installs never call the SDK directly. These calls exist for the cases where DeepSync can't infer something on its own — who a logged-in user is, that a purchase completed, or that consent was granted.
identify — attach a known user to a visitor
Call this once after login. It links the anonymous visitor profile to your own user ID, so every past and future session from that person is searchable by it.
deepsync("identify", user.id, {
email: user.email,
plan: "pro",
signupDate: user.createdAt,
});track — record a custom event
Custom events are what goals and funnel steps match on when a URL isn't enough — a purchase, a plan upgrade, a video completion.
deepsync("track", "purchase_completed", {
value: 4999,
currency: "INR",
items: 3,
});consent — unblock recording
Required when the project's tracking mode is consent-required. Until this fires, the SDK collects nothing.
// after the visitor accepts in your cookie banner
deepsync("consent", true);
// to withdraw and stop recording immediately
deepsync("consent", false);Other calls
| Call | What it does |
|---|---|
| deepsync("stop") | Stops recording for the rest of the page's life. Useful before entering a sensitive flow you never want captured. |
| deepsync("pageview", path) | Manually reports a page view. Only needed if you route without touching the History API. |
| deepsync("setUserProperty", key, value) | Updates one attribute on the current visitor profile without a full identify call. |
Related
Still have a question?
Support is included on every plan, including Free. Tell us what you're trying to do and we'll point you at the right page — or fix the docs.
Contact support