Mobile app version of vmapp.org
Login or Join
Shelton105

: 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

@Shelton105

Posted in: #Facebook #Marketing #Tracking

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&amp;cd[value]= {{transactionTotal}}amp;cd[currency]=USD&amp;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.

10% popularity Vote Up Vote Down


Login to follow query

More posts by @Shelton105

0 Comments

Sorted by latest first Latest Oldest Best

Back to top | Use Dark Theme