Skip to main content

Get the widget on your app

Everything you need to do to get started with Business Score widget.js.

Step 1 : Installation

You need to include widget.js on your web page by adding the script tag to the head of your HTML file.

index.html
<script src="https://wdjs-s.scorethebusiness.com/widget.js"/></script>

Step 2 : Instantiation

Next, create an instance of the Widget by providing your public API key as the first parameter; along with elementId parameter.

index.html
<script>
var widget = BusinessScoreWidget({
publicKey: "pk_123213123", //Required, provided by Business Score, instantiates your widget instance.
elementId: "bs-widget-popup", //HTML element id, where you want the widget to be displayed
});
</script>

Step 3 : Execution

Call the widget.show()` method on the instance you created in step 2, to display the widget.

index.html
<body onload="widget.show()"></body>