Basic Javascript

If you have a web app with multiple pages where each one triggers a new page refresh then you will most likely need the basic JavaScript method. This means you will not need to create separate actions which trigger when the Portal will appear or update. The page refresh itself is enough to trigger the action. To set up the basic JavaScript, you will only need to follow two steps.

How to Install

To get the Portal to appear on your web app simply copy and paste the snippets below on every page where you want the Portal to appear for website visitors. We recommend to add them to a single page with the url /portal and have all urls in /portal/* resolve this page.

1) Add tag for where to inline embed the portal

The snippet below should be added where you want the Portal to be inline embedded on your site. This is usually within your <body> tag.

<div id="wastehero-portal-div" style="height: calc(100vh); position: relative;">
  <!-- Wastehero portal will be embedded here -->

2) Add tag for where to inline embed the portal

The last snippet should be added at the end of your <body> tag.

  window.WH_SS_INIT_ROUTE = '/portal';
  window.WH_SS_ROOT_ELEMENT_ID = `wastehero-portal-div`;



This setting must be set to the same portal hostname as you have configured inside WasteHero under company settings.



This setting must be the url path of the root location on your site where you embed the Portal.