JSFiddle - React, Tailwind, and code Playground
HTML
Visitor ISO-3166-alpha2 country code : <b><span id="countryCode"></span></b><br />
Visitor country name : <b><span id="countryName"></span></b><br />
<script src="https://cdn.db-ip.com/js/dbip.js"
data-api-key="p6bcac47ae71f0285cb6343d9697e56e41a2cb92">
// Replace the demo key above with your own API key
</script>
<script>
dbip.getVisitorInfo().then(info => {
$("#countryCode").text(info.countryCode);
$("#countryName").text(info.countryName);
});
</script>