Google Dynamic Remarketing Code

Hello,
I have a webshop with more than 30,000 products. I want to start the google dynamic remarketing i.e. show the ad with the product that a user visited in my shop but did not checkout. To do so, I need to add the below Event snippet in all the product pages.
- How can I dynamically fetch the price and product id i.e. in place of replace with value below?
- Is there any variable for the same?
- Also, in order to place it in all the products page, where exactly should this be placed in the template?
<script>
gtag('event', 'page_view', {
'send_to': 'AW-XXXXXXXX',
'value': 'replace with value',
'items': [{
'id': 'replace with value',
'google_business_vertical': 'retail'
}]
});
</script>
Tags: