: Literal '{{transactionTotal}}' appear when using Facebook conversion pixel instead of it being replaced by a number I have this as the datalayer. When I view the sourcecode of the site, the datalayer
I have this as the datalayer. When I view the sourcecode of the site, the datalayer appears at the bottom of the page.
dataLayer = [{
transactionId: '172601',
transactionTotal: 6.09,
transactionTax: 0,
transactionShipping: 0,
transactionProducts: []
}];
dataLayer[0].transactionProducts.push({
sku: '297',
name: 'Time Slot Event - General Admission',
price: '1.05',
quantity: 1
});
I created this pixel for importing the transaction total. I removed the pixel id from it just for here. I do have the correct one in the end code.
<!-- Facebook Pixel Code -->
<script>
!function(f,b,e,v,n,t,s){if(f.fbq)return;n=f.fbq=function(){n.callMethod?
n.callMethod.apply(n,arguments):n.queue.push(arguments)};if(!f._fbq)f._fbq=n;
n.push=n;n.loaded=!0;n.version='2.0';n.queue=[];t=b.createElement(e);t.async=!0;
t.src=v;s=b.getElementsByTagName(e)[0];s.parentNode.insertBefore(t,s)}(window,
document,'script','//connect.facebook.net/en_US/fbevents.js');
fbq('init', '//pixelidhasbeenremoved//');
fbq('track', "PageView");
fbq('track', 'CompleteRegistration', {
content_name: '{{transactionId}}',
value: '{{transactionTotal}}',
currency: 'USD'
});
</script>
<noscript>
<img height="1" width="1" style="display:none" src="https://www.facebook.com/tr?id=//pixelidhasbeenremoved//&ev=PageView&noscript=1"/>
<img height="1" width="1" style="display:none" src="https://www.facebook.com/tr?id=//pixelidhasbeenremoved//&ev=CompleteRegistration&cd[value]= {{transactionTotal}}amp;cd[currency]=USD&noscript=1"/>
</noscript>
<!-- End Facebook Pixel Code -->
It is only pulling in {{transactionTotal}} for the price rather than the the variable itself. Anyone know where I am going wrong here? I have created them fine for a few other sites, but this one is just not cooperating.
More posts by @Shelton105
Terms of Use Create Support ticket Your support tickets Stock Market News! © vmapp.org2024 All Rights reserved.