Reputation: 41
I've created a custom HTML tag for Facebook's Purchase Events that contains 3 custom variables.
They reference data the dataLayer but Facebook Pixel Helper is showing all 3 values as undefined:
<script>
fbq('track', 'Purchase', {
content_name: '{{transactionId}}',
value: '{{transactionTotal}}',
currency: '{{transactionCurrency}}'
});
</script>
<noscript>
<img height="1" width="1" border="0" alt="" style="display:none"
src="https://www.facebook.com/tr?id=0000000000000&ev=Purchase&cd[content_name]={{transactionId}}&cd[value]={{transactionTotal}}&cd[currency]={{transactionCurrency}}" />
</noscript>
Any ideas why the data isn't passing into the Pixel correctly?
Upvotes: 0
Views: 2714
Reputation: 41
I found the trigger was firing on Page View, and the dataLayer variables were undefined at that point, switching the trigger to fire on the DOM, fixed it.
Upvotes: 4
Reputation: 58
Are you sure that facebook pixel fires in the same trigger as your dataLayer variables or later?
Data may not be transmitted if these variables are initialized after the facebook pixel fires or if these variables are overwritten to undefined before facebook tag is activated.
Upvotes: 0