API Reference

We have added a lot of flexibility to how the widget is displayed, so you can provide a seamless experience for your users as much as possible.

The widget is built mobile first, so should scale down gracefully to the smallest of devices. You can display the Business Score widget in three modes; popup, in-line and full screen.

Full screen display mode

To use the widget in full screen mode, instantiate your widget with the following parameters.

<body id="body" style="margin: 0"> // Ensure you have an html element with an element id you can pass to the widget, setting margin to 0 as some browers add a margin to the body tag
</body>
<script>
   BusinessScoreWidget({
     elementId: 'body',
     publicKey: ...,
     width: '100vw',
     height: '1000px', // This is the height of your screen in px
   }).show()
</script>

Finally ensure you call the widget.show() method on window unload.

Pop up display mode

To use the widget as a pop up, instantiate your widget with the following parameters.

Ensure the popup parameter is set to true

<script>
   var widget = BusinessScoreWidget({
     elementId: ...,
     publicKey: ...,
     popup: true,
     height: "700px",
     width: "500px",
   });
</script>

Finally call the widget.show() method on an HTML element.

<button type="button" onclick="widget.show()">
	Show Widget
</button>

In place display mode

To disaply the widget in-place, instantiate your widget with the following parameters.

<script>
   var widget = BusinessScoreWidget({
     elementId: ...,
     publicKey: ...,
     height: "700px",
     width: "100vw",
   });
</script>

Finally call the widget.show() method on an HTML element.

<button type="button" onclick="widget.show()">
	Show Widget
</button>
<button type="button" onclick="widget.hide()">
	Hide Widget
</button>