async function loadSproutCounter() { var base_uri = "https://sprout-api.thegoodapi.com"; var integrationID = "65b3fbc97ec61656092d4d73"; var locale = ""; if (locale == null) { locale = ""; } const uri =`${base_uri}/ss/api/badge/counter?integration_id=${integrationID}&locale=${locale}`; var resp = await fetch(uri); var data = await resp.text(); var element = document.getElementById("SproutTreeCountVintage"); if (element == null) { // Create the element if it doesn't exist element = document.createElement("div"); element.id = "SproutTreeCountVintage"; // You can customize the element creation here if needed // Append the element to the document or a specific container document.body.appendChild(element); // Change this line as per your requirement } element.innerHTML = data; } loadSproutCounter();