Library version, this also is the same as our API version
This method checks if there's a browser id assigned to the user, creates a new browser id if no id found or assigned id is expired. This method is called automatically within Signal.init
signal.browser()
Usage with callback
signal.browser(browserId => {
console.log('Browser ID', browserId)
})
Calling the debug method turns on debug mode, which logs helpful messages to the console.
signal.debug() // set to true
signal.debug(false) // set to false
signal.debug(true) // set to true
next debug value (default: true)
This method is used to call event types
signal.event(type)
// with params
signal.event(type, {tags: ['tag1', 'tag2'],...})
usage with callback
signal.event(type, (eventData) => {
console.log('event data', eventData)
})
signal.event(type, {title: 'Sample'}, (eventData) => {
console.log('event data', eventData)
})
This method clears identityId
from storage if one exist
signal.forget()
This method creates new IIdentity. Takes an optional callback that
either takes an @{link IIdentity} when an identity is created or
undefined
when no identity created, means there's already one in our storage
signal.identity({
referenceId: 'CUSTOMER-123',
email: 'test@email.com',
source: 'login',
attributes: {
name: 'test'
}
}, identity => console.log('identity created',identity))
The init method lets you initialise signal before any usage within the page
signal.init('CLIENT_TOKEN')
Usage with custom base URL
signal.init('CLIENT_TOKEN', {baseUrl: 'https://custom-url'})
account CLIENT_TOKEN
configuration object
This method checks if the provided IInitOptions.baseUrl is valid or not.
signal.ping()
Usage with callback
signal.ping(isAlive => {
console.log('Base URL alive', isAlive)
})
takes isAlive
boolean parameter which is true
if the url is alive or false
if not
This method checks if there's a session id assigned to the user, creates a new session id if no id found or assigned id is expired. This method is called automatically within Signal.init
signal.session()
Usage with callback
signal.session(sessionId => {
console.log('Session ID', sessionId)
})
Generated using TypeDoc
Class representing all exposed Signal methods