: How to add AggregateRating in GTM using DOM element Variables? Here is the JSON-LD script that i use for implementing product schema in GTM using DOM variables. <script> var jsonData = {
Here is the JSON-LD script that i use for implementing product schema in GTM using DOM variables.
<script>
var jsonData = {
"@context": "http://schema.org",
"@type": "Product",
"name": {{productName}},
"image": {{productImg}},
"url": {{Page URL}},
"aggregateRating": {
"@type": "AggregateRating",
"ratingValue": {{avgRating}},
"reviewCount": {{ratingsCount}},
}
}
var script = document.createElement('script');
script.type = 'application/ld+json';
script.text = JSON.stringify(jsonData);
$("head").append(script);
</script>
DOM Variable Configuration:
But while debugging the page, the avgRating and ratingsCount value showing 'null'.
I am unable to find out where is the main error that the value not being extract from the page. How can i solve the problem..Please mention if there is any error in the schema code and the DOM variable configuration. Thanks in Advance..
More posts by @Harper822
Terms of Use Create Support ticket Your support tickets Stock Market News! © vmapp.org2024 All Rights reserved.