I would think this is possible but I didn't see in the docs how to accomplish it.
I want to use the output of a couple of MVT entities as variable values to be picked up by a little javascript for google ad remarketing.
It looked like the entities could be read by javascript but I think I'm not quite placing them correctly.
TL;DR -- Resolution
I was on the phone with someone from Google ads and with her help and a tech on the google end, they were able to shape the tag into what they needed. It seems that what I had written was technically correct but didn't quite address the issues they were trying to solve. But we got it done and now all is well.
I want to use the output of a couple of MVT entities as variable values to be picked up by a little javascript for google ad remarketing.
It looked like the entities could be read by javascript but I think I'm not quite placing them correctly.
Code:
// using mvt entities instead of js dom objects because the script has to go into the head tag
<script>
var gtag_item_value = &mvt:product:price;
var gtag_item_id = &mvt:product:id;
gtag('event', 'page_view', {
'send_to': 'AW-987194077',
'value': gtag_item_value,
'items': [{
'id': gtag_item_id,
'google_business_vertical': 'retail'
}]
});
</script>
I was on the phone with someone from Google ads and with her help and a tech on the google end, they were able to shape the tag into what they needed. It seems that what I had written was technically correct but didn't quite address the issues they were trying to solve. But we got it done and now all is well.
Comment