I'm setting up google structured data via javscript, using dom element
like this
function setStructuredDataGeneral() {
structuredData = '{"@context": "https://schema.org/", "@type": "Product", "name": "Ofertas", "image": "<?php echo $wLanding->getFSlideImage(); ?>", "offers": { "@type": "AggregateOffer", "lowPrice": "'+Math.min(...offerPrices)+'", "highPrice": "'+Math.max(...offerPrices)+'", "priceCurrency": "EUR"}}';
var elementScriptStructuredData = document.getElementById("structuredDataGeneral");
var text = document.createTextNode(structuredData);
elementScriptStructuredData.appendChild(text);
}
then I have a sctipt tag where it goes
<script type="application/ld+json" id="structuredDataGeneral">
</script>
when I check the website it works, generate the expected results, problem is when I try to validate the URL via google structured data tool (https://search.google.com/structured-data/testing-tool) the tag is empty.
Its because this tool doesn't load javascript or I'm doing it wrong?