Hi everyone. Hopefully someone more in the know than me can advise.
We are trying to configure the Facebook Pixel in version 18.0.0.5, Swift template, for Dynamic Ads. I am trying my best to set this up but I confess I am not a natural at this. This is what we are following https://www.facebook.com/business/he...05376682832142
Our current code is as follows:
<actinic:block if="%3cactinic%3avariable%20name%3d%22FacebookPixelID%22%20%2f%3e%20%21%3d%20%22%22%20%20AND%20%3cactinic%3avariable%20name%3d%22IsNotPreviewMode%22%20%2f%3e" >
<!-- 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','https://connect.facebook.net/en_US/fbevents.js');
fbq('init', '<actinic:variable name="FacebookPixelID" />');
<actinic:block if="%3cactinic%3avariable%20name%3d%22PageType%22%20%2f%3e%20%3d%3d%20%22Product%20Page%22">
fbq('track', 'PageView', {
content_ids: ['<actinic:variable name="ProductID" />'],
content_type: 'product'
});
</actinic:block>
<actinic:block if="%3cactinic%3avariable%20name%3d%22PageType%22%20%2f%3e%20%20%21%3d%20%22Product%20Page%22" >
fbq('track', 'PageView',);
</actinic:block>
<actinic:block if="%3cactinic%3avariable%20name%3d%22PageType%22%20%2f%3e%20%3d%3d%20%22Search%20Results%22" >
fbq('track', 'Search');
</actinic:block>
<actinic:block if="%3cactinic%3avariable%20name%3d%22PageType%22%20%2f%3e%20%3d%3d%20%22Add%20To%20Cart%20Confirmation%22">
fbq('track', 'AddToCart', {
content_ids: ['<actinic:variable name="ProductRef" />'],
content_type: 'product'
});
</actinic:block>
<actinic:block if="%3cactinic%3avariable%20name%3d%22PageType%22%20%2f%3e%20%3d%3d%20%22Product%20Page%22" >
fbq('track', 'ViewContent', {
content_ids: ['<actinic:variable name="ProductID" />'],
content_type: 'product'
});
</actinic:block>
<actinic:block if="%3cactinic%3avariable%20name%3d%22PageType%22%20%2f%3e%20%3d%3d%20%22Checkout%20Page%200%22" >
fbq('track', 'InitiateCheckout', {
value: '<Actinic:XMLTEMPLATE NAME="FBPixelInfo"><actinic:variable name="NumericOrderTotal" selectable="false" /></Actinic:XMLTEMPLATE>',
currency: '<actinic:variable name="DefaultIntCurrencySymbol" />'});
</actinic:block>
<actinic:block if="%3cactinic%3avariable%20name%3d%22PageType%22%20%2f%3e%20%3d%3d%20%22Receipt%22" >
fbq('track', 'Purchase', {
value: '<actinic:variable name="NumericOrderTotal" />',
currency: '<actinic:variable name="DefaultIntCurrencySymbol" />',
content_ids: ['<actinic:variable name="ProductRef" />'],
content_type: 'product'});
</actinic:block>
</script>
<noscript>
<img height="1" width="1" src="https://www.facebook.com/tr?id=<actinic:variable name="FacebookPixelID" />&ev=PageView&noscript=1" />
</noscript>
<!-- End Facebook Pixel Code -->
</actinic:block>
For dynamic ads, FB seems to need 3 required events - Page View, Purchase and Add to Cart, with extra parameters applied to each.
I "think" the Page View is set up and working ok? but we do not seem to be receiving Add to Cart events - is there a better way to code this?
Also, I have been trying to use the ProductID variable in most cases, but have been getting coding errors - again, I do not understand enough about SD to know when or when not to use this variable. So, instead, I chose ProductRef which SD seemed to like but I do not know if it will work or not.
If anyone has any experience of how to set this up correctly, I would be grateful for any tips!
Thanks
Adam
We are trying to configure the Facebook Pixel in version 18.0.0.5, Swift template, for Dynamic Ads. I am trying my best to set this up but I confess I am not a natural at this. This is what we are following https://www.facebook.com/business/he...05376682832142
Our current code is as follows:
<actinic:block if="%3cactinic%3avariable%20name%3d%22FacebookPixelID%22%20%2f%3e%20%21%3d%20%22%22%20%20AND%20%3cactinic%3avariable%20name%3d%22IsNotPreviewMode%22%20%2f%3e" >
<!-- 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','https://connect.facebook.net/en_US/fbevents.js');
fbq('init', '<actinic:variable name="FacebookPixelID" />');
<actinic:block if="%3cactinic%3avariable%20name%3d%22PageType%22%20%2f%3e%20%3d%3d%20%22Product%20Page%22">
fbq('track', 'PageView', {
content_ids: ['<actinic:variable name="ProductID" />'],
content_type: 'product'
});
</actinic:block>
<actinic:block if="%3cactinic%3avariable%20name%3d%22PageType%22%20%2f%3e%20%20%21%3d%20%22Product%20Page%22" >
fbq('track', 'PageView',);
</actinic:block>
<actinic:block if="%3cactinic%3avariable%20name%3d%22PageType%22%20%2f%3e%20%3d%3d%20%22Search%20Results%22" >
fbq('track', 'Search');
</actinic:block>
<actinic:block if="%3cactinic%3avariable%20name%3d%22PageType%22%20%2f%3e%20%3d%3d%20%22Add%20To%20Cart%20Confirmation%22">
fbq('track', 'AddToCart', {
content_ids: ['<actinic:variable name="ProductRef" />'],
content_type: 'product'
});
</actinic:block>
<actinic:block if="%3cactinic%3avariable%20name%3d%22PageType%22%20%2f%3e%20%3d%3d%20%22Product%20Page%22" >
fbq('track', 'ViewContent', {
content_ids: ['<actinic:variable name="ProductID" />'],
content_type: 'product'
});
</actinic:block>
<actinic:block if="%3cactinic%3avariable%20name%3d%22PageType%22%20%2f%3e%20%3d%3d%20%22Checkout%20Page%200%22" >
fbq('track', 'InitiateCheckout', {
value: '<Actinic:XMLTEMPLATE NAME="FBPixelInfo"><actinic:variable name="NumericOrderTotal" selectable="false" /></Actinic:XMLTEMPLATE>',
currency: '<actinic:variable name="DefaultIntCurrencySymbol" />'});
</actinic:block>
<actinic:block if="%3cactinic%3avariable%20name%3d%22PageType%22%20%2f%3e%20%3d%3d%20%22Receipt%22" >
fbq('track', 'Purchase', {
value: '<actinic:variable name="NumericOrderTotal" />',
currency: '<actinic:variable name="DefaultIntCurrencySymbol" />',
content_ids: ['<actinic:variable name="ProductRef" />'],
content_type: 'product'});
</actinic:block>
</script>
<noscript>
<img height="1" width="1" src="https://www.facebook.com/tr?id=<actinic:variable name="FacebookPixelID" />&ev=PageView&noscript=1" />
</noscript>
<!-- End Facebook Pixel Code -->
</actinic:block>
For dynamic ads, FB seems to need 3 required events - Page View, Purchase and Add to Cart, with extra parameters applied to each.
I "think" the Page View is set up and working ok? but we do not seem to be receiving Add to Cart events - is there a better way to code this?
Also, I have been trying to use the ProductID variable in most cases, but have been getting coding errors - again, I do not understand enough about SD to know when or when not to use this variable. So, instead, I chose ProductRef which SD seemed to like but I do not know if it will work or not.
If anyone has any experience of how to set this up correctly, I would be grateful for any tips!
Thanks
Adam
Comment