Skip to main content

Conditional Redirect Event

Allows you redirect users on the basis of the data in session storage of a browser.


How does the Conditional Redirect event work?

External API

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.

DrapCode Builder Conditional Redirect Event

2. Create a REST API

As you open the external API page, click the Create button to create an external API.

DrapCode Builder Conditional Redirect Event

3. Name & Select the Request Type

Name the external API and select GET as the request type as shown in the image below.

DrapCode Builder Conditional Redirect Event

4. Add the URL

Now add the external API URL. In the example below, we have used a dummy external API URL.

DrapCode Builder Conditional Redirect Event

5. Send Request

Click on the Send Request button to receive a response and proceed further.

DrapCode Builder Conditional Redirect Event

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.

DrapCode Builder Conditional Redirect Event

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.

DrapCode Builder Conditional Redirect Event

As you click the button, an external API will be created and start showing on the external API page as shown below.

DrapCode Builder Conditional Redirect Event

External API Event

8. Go to Events

Go to the Events panel and click the Add Event button.

DrapCode Builder Conditional Redirect Event

9. Name the Event

Type the name of the event as you want and click the Create button as shown below.

DrapCode Builder Conditional Redirect Event

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.

DrapCode Builder Conditional Redirect Event

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.

DrapCode Builder Conditional Redirect Event

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.

DrapCode Builder Conditional Redirect Event

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.

DrapCode Builder Conditional Redirect Event

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.

DrapCode Builder Conditional Redirect Event

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.

DrapCode Builder Conditional Redirect Event

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.

DrapCode Builder Conditional Redirect Event

17. Choose Data Location

Select the option, Session as the data location from the drop-down list.

DrapCode Builder Conditional Redirect Event

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.

DrapCode Builder Conditional Redirect Event

You can also select any piece of data within the session storage data.

DrapCode Builder Conditional Redirect Event

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.

DrapCode Builder Conditional Redirect Event

20. Bind the Conditional Redirect Event

Open a page and drop a button in it. Then, bind the conditional redirect event to it.

DrapCode Builder Conditional Redirect Event

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.

DrapCode Builder Conditional Redirect Event

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.

DrapCode Builder Conditional Redirect Event