Skip to content

DCA widget

This document describes the steps to take in order to embed the BTC Direct dollar cost average form widget in another website. It is aimed at developers that will implement this functionality.

In order to enable the widget in your website, the following script needs to be embedded. This script loads the widget from the BTC Direct CDN (Content Delivery Network) and initializes it automatically.

<script lang="js">
(function (btc, d, i, r, e, c, t) {
btc[r] = btc[r] || function() {
(btc[r].q = btc[r].q || []).push(arguments)
};
c = d.createElement(i);
c.id = r; c.src = e; c.async = true;
c.type = 'module'; c.dataset.btcdirect = '';
t = d.getElementsByTagName(i)[0];
t.parentNode.insertBefore(c, t);
})(window, document, 'script', 'btcdirect',
'https://cdn.btcdirect.eu/dollar-cost-average/dollar-cost-average.js'
);
btcdirect('init', { token: 'API_KEY' });
</script>

If a valid key is provided, and the styling is added, it will result in the following:

Note that there is a starting screen by default. There is a setting that shows the overview as the starting page instead. This can be done with the startInOverview setting that is described in the parameters page.

When navigating to the next page using the “Get started” button you may notice that the dropdown for wallet addresses is empty. This is because the widget expects the user’s wallet addresses to be provided in order to select them.