Home > Technical & Creative Skills > Tracking Campaigns

Cake <--> Facebook pixel Event (3)


01-11-2019 07:21 PM #1 omarter (Member)
Cake <--> Facebook pixel Event

Hello,

I am new on cake platform and i am not sure how to track Facebook event.
Is it necessary to use postback tools to have accurate information ? If no, what kind of script need to be implemented ?

Thank you a lot


01-11-2019 09:03 PM #2 Mr Baffoe (Veteran Member)

I haven't been on a CAKE account in a while, do they allow you to add javascript pixel code?

If so, just paste in the fb pixel code and make sure to also add the event tracking right after the page view event

eg

Code:
fbq('track', 'Purchase');
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',
  'https://connect.facebook.net/en_US/fbevents.js');
  fbq('init', 'your-pixel-id-goes-here');
  fbq('track', 'PageView');
  fbq('track', 'Purchase');
</script>
<noscript>
  <img height="1" width="1" style="display:none" 
       src="https://www.facebook.com/tr?id=your-pixel-id-goes-here&ev=PageView&noscript=1"/>
 <img height="1" width="1" style="display:none" 
       src="https://www.facebook.com/tr?id=your-pixel-id-goes-here&ev= Purchase&noscript=1"/>
</noscript>
<!-- End Facebook Pixel Code -->
you can also track it with just an image, less ideal

eg

Code:
<img height="1" width="1" style="display:none" src="https://www.facebook.com/tr?id=your-pixel-id-goes-here&ev= Purchase&noscript=1"/>
the part to edit would be &ev=Purchase where Purchase would be replaced with whatever event you want to track


01-12-2019 08:51 PM #3 Resfa23 (Member)

Hi guys,

Using the cake platform too and tracking using the code above for the events ViewContent, AddToCart, InitiateCheckout, and Purchase.
In all events, I also include code for the PageView event.

The problem is that FB Pixel Helper for event PageView has a warning "The Facebook pixel activated 2 times on this web page, which can cause errors in your event tracking." and event ViewContent has a warning "We detected event code but the pixel has not activated for this event, so no information was sent to Facebook. This could be due to an error in the code, but could also occur if the pixel fires on a dynamic event such as a button click."

Trying to understand what is happening, I realized that the selling funnel was concluded all in one page (checkout info appears at the bottom of the page).

Can this be the problem? Should, in such landing pages, do not fire PageView events alongside the other events (AddToCart, InitiateCheckout and Purchase)? What could be the best course of action?


Home > Technical & Creative Skills > Tracking Campaigns