So i have used the following code to implement the customer reviews badge.
<script src="https://apis.google.com/js/platform.js?onload=renderBadge"
async defer>
</script>
<script>
window.renderBadge = function() {
var ratingBadgeContainer = document.createElement("div");
document.body.appendChild(ratingBadgeContainer);
window.gapi.load('ratingbadge', function() {
window.gapi.ratingbadge.render(
ratingBadgeContainer, {
"merchant_id": 42,
"position": "BOTTOM_LEFT"
});
});
}
</script>
<!-- END GCR Badge Code -->
<!-- BEGIN GCR Language Code -->
<script>
window.___gcfg = {
lang: 'en_US'
};
</script>
<g:ratingbadge merchant_id=MERCHANT_ID></g:ratingbadge>
But is it even possible to get this working on the local machine?
Also by local machine I mean running the visual studio solution on my computer. So it's not in a publically accessible website.
Cheers
Ok so I figured this out,
It turns out the badge wont render on the local machine http://localhost
Also the customer reviews code I got from google was implemented throuh google tag manager. Upon analysis the badge was not rendering, so when I added the customer reviews code into the footer (so not throuh tag manager) it was working.
Conclusion
The google customer reviews code must be on the live server to work.(So not http://localhost) etc.
The code must be included directly in the theme files. NOT THROUGH GOOGLE TAG MANAGER