Skip to main content

Create a client

string
required
Base URL of the Era service.
string
required
Publishable key for browser identity and verification requests.
See all Web SDK types.

init(visitorId?)

Loads the stored visitor or creates one.
The returned ID starts with era_vid_. Pass a lowercase UUIDv4 when your application already has a visitor UUID:
The SDK validates the value, adds the prefix, stores it, and returns the canonical ID.

getVisitorId()

Reads the current visitor without creating one.
Returns the stored or in-memory visitor, or null when none exists.

getVerification()

Checks whether the current visitor is linked to an Era end user.
eraEndUserId is an opaque Era ID or null. It is not proof that the user is signed in to your application.

startVerification(type, identifier)

Sends an email or phone verification code.
Use E.164 format for phone numbers.

confirmVerification(challengeId, code)

Confirms a code and links the current visitor.

resendVerification(challengeId)

Sends another code.
Use the returned challenge for the next confirm or resend call. Its ID and expiry can change.

resetVisitor()

Replaces the current visitor and returns the new ID.
Use this after logout, account switching, or a shared-device user change. Operations that cross the reset boundary reject with error code visitor_reset.

Storage

The SDK stores the visitor in localStorage under:
If browser storage is unavailable, the visitor remains in memory for the current page. SDK instances for the same partner share the current visitor, and open tabs synchronize changes through browser storage events. See Web SDK errors.