API REFERENCE

Reference to Asayer JavaScript API.

start

The method starts the new session recording or continues the one which was previously stopped (only if the time between stop and start is not more then a few seconds). This method is called automatically when using Asayer script.

asayer.start();

stop

The method stops the current session recording.

asayer.stop();

userID

Associates the userID to the recorded session. The method should be called with one string argument.

asayer.userID('user@asayer.io');

userAnonymousID

Associates the userAnonymousID to the recorded session. The method should be called with one string argument.

asayer.userAnonymousID('Ishd43ada89');

metadata

Associates metadata value to the current session recording. These variables should be manually added beforehand under Preferences > Metadata in your dashboard. The method should be called with two string arguments (key and value).

asayer.metadata('plan', 'premium');

event

Sends custom event to the session recorder. These events are searchable by the first argument, which should be a string, and optionally can have a second argument with custom payload.

asayer.event('stripe', {
'count': 2,
'price': 28.13
});

active

asayer.active();

Returns true if the session is recording, false otherwise.

sessionID

Most integrations with downstream systems require the use of sessionID. In the case of an integration with a log management tool (e.g. Sentry), sessionID, which is generated by Asayer upon recording a user session, can be passed (e.g. HTTP header) from your frontend to your backend then injected into your logs. That way, your backend logs can be pulled (from your Log Management tool) and played back alongside your user session replay.

asayer.sessionID();

Return the string representation of the uint64 session ID or undefined if it's not yet assigned.