Allows you redirect users on the basis of the data in session storage of a browser.
How does the Conditional Redirect event works?
Start by creating an external API so that an API call can be made.
1. Go to External API
Go to the builder console and take the cursor to Settings in the bottom bar. Click on External API option in the drop-down list.
2. Create a REST API
As you open the external API page, click the Create button to create an external API.
3. Name & Select the Request Type
Name the external API and select GET as the request type as shown in the image below.
4. Add the URL
Now add the external API URL. In the example below, we have used a dummy external API URL.
5. Send Request
Click on the Send Request button to receive a response and proceed further.
6. Map Data to/from Collection
After clicking the button, scroll down and click on the Map Data to/from Collection button to proceed further.
7. Save Settings
As we are making a simple external API to add data in session storage, we will not map the collection. So, scroll down and just click the Save Settings button.
As you click the button, an external API will be created and start showing on the external API page as shown below.
External API Event
8. Go to Events
Go to the Events panel and click the Add Event button.
9. Name the Event
Type the name of the event as you want and click the Create button as shown below.
10. Select "Send Data to External API" Event
Click on the add icon and take the cursor to the External API option in the drop-down list. Then, select the Send Data to External API event action.
11. Select the External API
All external APIs, you have created will appear in the form of a drop-down list. Select the external API you previously created.
12. Save Response in Session
As we are trying to use data in session storage to redirect users, tick the Save Response in Session checkbox as shown below. Then, click the Save button.
13. Bind the External API Event
Go to a page and drop a button in it. Then bind the Send Data to External API event to it as shown below.
14. Preview or Publish
Now open the page in a preview or publish mode and open the page console and go to Application. Under Session Storage, you will find no data.
15. Make an API Call
Click the button and make an external API call. Now again open the Session Storage and you will find data in it as shown below.
Conditional Redirect Event
16. Create a Conditional Redirect Event
Click on the add icon and take the cursor to the Navigation option in the drop-down list. Then, select the Conditional Redirect event action.
17. Choose Data Location
Select the option, Session as the data location from the drop-down list.
18. Session Field Name
As you select the option, Session, a new field will appear below it where you have add the session field name, such as status, total, scroll_token, etc.
You can also select any piece of data within the session storage data.
19. Field Value, Page & Target
Add field value, choose the page you want user to redirect and also tick the target checkbox.
Whenever, the added field value to sent via the API call, the user will be redirected to the selected page.
20. Bind the Conditional Redirect Event
Open a page and drop a button in it. Then, bind the conditional redirect event to it.
21. Preview or Publish
Open the page in the publish or preview mode. As API call has already been made, you will be redirected to the Company Details page.
22. Default Field Value
Now clear the data of the session storage and then click the conditional redirect button. You will be redirected to the home page.