How to fix: FB-Pixel detected event code but the pixel has not activated

Mario Burkhardt picture Mario Burkhardt · Sep 11, 2019 · Viewed 13.9k times · Source

We have a Woocommerce Page with a Facebook Pixel integration, on the category pages the pixel fires the following code:

content_type: product_group domain: www.xxxxxx.tld content_category: Not Set event_hour: 15-16 user_roles: guest content_name: Abo content_ids: Hide ["wc_post_id_4987","wc_post_id_4994","wc_post_id_4979","wc_post_id_4968","wc_post_id_4952"]

We created pages in Wordpress that we use as the category pages after A/B testing them to be better then the default category pages, but the ViewCategory Facebook Event is not triggered on those pages, which is an issue for retargeting.

Now we build this code and added it to the pages that are not categories:

<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');
// Insert Your Facebook Pixel ID below.
fbq('init', 'XXXXXXXXXXXX');

fbq('trackCustom', 'ViewCategory', {
  content_name: 'Kauknochen fu00fcr Hunde',
  content_category: 'Kauknochen',
  content_ids: ['4154', '4183', '4165', '4171', '4176'], // top 5-10 results
  content_type: 'product'
});

alert( 'Hellopen!' );</script>

The alert is shown when opening the site so the script is executed however the Event is displayed in the FB Pixel Helper with the error: "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."

changing the event to an other event does not trigger either

we would expect the result to be like this:

ViewCategory

CUSTOM PARAMETERS SENT content_type: product_group domain: www.xxxxx.tld content_category: Not Set event_hour: 15-16 user_roles: guest content_name: Abo content_ids: Hide ["wc_post_id_4987","wc_post_id_4994","wc_post_id_4979","wc_post_id_4968","wc_post_id_4952"] plugin: PixelYourSite event_day: Wednesday event_month: September traffic_source: www.xxxxx.tld EVENT INFO URL Called: Show Load Time: 17.49 ms Pixel Code: Show Pixel Location: Show Frame: Window

Answer

Sayakiss picture Sayakiss · Sep 11, 2019

trackCustom is not defined, and if you want to custom event, you should use fbq('track', ...) instead of fbq('trackCustom', ...).

The whole code would be:

fbq('track', 'ViewCategory', {
  content_name: 'Kauknochen fu00fcr Hunde',
  content_category: 'Kauknochen',
  content_ids: ['4154', '4183', '4165', '4171', '4176'], // top 5-10 results
  content_type: 'product'
});