Reputation: 5
I have a DataLayer variable holding the sum of a purchase. I wish to insert this variable into a custom HTML tag. The value variable in the following code should hold the value of the DataLayer variable.
<!-- Facebook Conversion Code for Checkouts -->
<script>(function() {
var _fbq = window._fbq || (window._fbq = []);
if (!_fbq.loaded) {
var fbds = document.createElement('script');
fbds.async = true;
fbds.src = '//connect.facebook.net/en_US/fbds.js';
var s = document.getElementsByTagName('script')[0];
s.parentNode.insertBefore(fbds, s);
_fbq.loaded = true;
}
})();
window._fbq = window._fbq || [];
window._fbq.push(['track', '', {'value':'0.00','currency':'USD'}]);
</script>
Upvotes: 0
Views: 2045
Reputation: 8907
You can insert datalayer variables by direct reference through double curly braces, {{value}}. Make sure it is defined as a datalayer variable first.
Upvotes: 1