Changing the starting block
Last updated
Last updated
There are many situations where you might want to show a different message to the user when they start a conversation. For example, this might be on a particular day of the week, or based on the page they are currently viewing. Both IntelAgent and the chat widget support this use case and enabling it is very simple.
Just as you would pass other options, there is a startBlock
option which can be set to change the initial block sent to a user. This can be used as follows :
The startBlock
parameter shown is either the Block ID
of the block you wish to trigger or the title
of the block.
In this example, setting startBlock
to either 5c62ead3ab358c3780bb60dc or intro
will trigger the same block.
While there may be lots of scenarios where you want to trigger different blocks, one such example might be based on the URL the user is currently on. The following example will show you how to add some code to the way you load the widget so that you will get a different block each time.
Note that by using the getQueryParam
option as well we can also allow the starting block to be changed based on the URL the user has clicked on. For example, the following URL could open a page and specify a specific block to load.