> ## Documentation Index
> Fetch the complete documentation index at: https://help.revenuehero.io/llms.txt
> Use this file to discover all available pages before exploring further.

# How to install the scheduler script?

> Here are the steps that would help you embed the RevenueHero widget on your thank you pagepage.

**Install widget on a thank you page**

<Note>
  Ensure the following:

  1. Disable redirection for the form.
  2. The redirection link must be from the same domain as the form page.
</Note>

There are two parts to the setup:

1. Installing the script on the form page.
2. Installing the script on the thank you page.

## On the form page

1. Paste this script after your form.

```
<script>

 //Replace formID with your form's ID
 document.querySelector("#formID").addEventListener("submit", (e) => {

  // Collect form field values
  const rhSubmitData = Object.fromEntries(new FormData(e.target).entries());

  // Store data in localstorage because page is going to redirect. Replace routerID.

  localStorage.setItem('rhdata', JSON.stringify(rhSubmitData));
  localStorage.setItem('rhid', 'routerID');

  //Set redirection link to thank you page. Replace with your URL.
  window.location.href = "https://redirect.com";

});
</script>

```

2. Replace the following in the aformentioned script:

| Find in snippet |       Replace with      |
| :-------------- | :---------------------: |
| formID          |      your form's ID     |
| routerID        |     your router's ID    |
| redirect.com    | your thank-you page URL |

## On the thank you page

1. Paste this script in your page's `<body>`.

```

<script type="text/javascript" src="https://app.revenuehero.io/scheduler.min.js"></script>
<script>

//retrieve the data from local storage
var revdata = localStorage.getItem('rhdata');
	if(revdata !== null) {
	var jsonData = JSON.parse(revdata);

//pass the data to RevenueHero and call the scheduler

 	 window.hero = new RevenueHero({ routerId: localStorage.getItem("rhid") })
  	 hero.submit(jsonData).then(function(sessionData) {
     hero.dialog.open(sessionData);

//delete the data from local storage
     localStorage.removeItem("rhdata");
     localStorage.removeItem("rhid");
  });
}
</script>

```

2. You're all set!
