Clears this browser's identity and starts a new anonymous browsing session
When a user has changed from one identity to another, the clear
function should be called to start a new browsing history. This should always be called when a user logs out of an identified session.
When called, p13n.js
will stop tracking this user as the previously-identified user, clear all browser cookies previously stored, and start a new anonymous browsing profile for subsequent behavior for this browser.
bt('clear', settings={});
The clear
function has one field:
Field | Type | Description |
---|---|---|
settings | Object | Settings specific to this event. Currently supports specification of onComplete , onSuccess , and onFailure callback functions. See Settings below for more information. |
Settings
The settings
object is used for configuring the clear
call.
Three settings
objects are currently allowed for clear
calls using the p13n.js
library:
Object | Description |
---|---|
onComplete | This setting allows the caller to specify a callback function once the clear function has completed. The function will be called regardless of whether the clear was successful or not. The function should have no parameters (nothing will be passed to it). |
onFailure(error) | This setting allows the caller to specify a callback function if the clear function has completed with an error. The error raised by the clear function will be passed into this callback. |
onSuccess | This setting allows the caller to specify a callback function once the clear function has completed successfully. The function should have no parameters (nothing will be passed to it). |
bt('clear', {onComplete: function() { console.log('Clear function completed!'); }});
bt('clear', {onFailure: function(err) { console.log('Error!: ' + err); }});
bt('clear', {onSuccess: function() { console.log('All clear!'); }});