Meta Pixel – InitiateCheckout Event

/** * ============================================================================= * META PIXEL — InitiateCheckout (WooCommerce Checkout) * ============================================================================= * Fires on checkout page (not thank you). * Includes contents + value. * Adds a sessionStorage guard to reduce accidental duplicates. */ add_action(‘wp_footer’, ‘voelgoed_meta_pixel_initiate_checkout’, 20); function voelgoed_meta_pixel_initiate_checkout()…Continue reading

Meta Pixel – Purchase Event

/** * ============================================================================= * META PIXEL — Purchase (WooCommerce Thank You) — Dedup ready for CAPI * ============================================================================= * – Fires on thank-you page ONLY for paid orders (processing/completed) * – Uses variation_id when present * – Adds eventID =…Continue reading

Meta Pixel – AddToCart Event

/** * ============================================================================= * META PIXEL — AddToCart * ============================================================================= * – Single product: fires on form submit (no jQuery required) * – Archives AJAX: listens to WooCommerce ‘added_to_cart’ (requires jQuery) * – Fallback: click listener on add_to_cart_button if jQuery…Continue reading

Meta Pixel – ViewContent Event

// Track ViewContent event on product pages add_action(‘wp_footer’, ‘voelgoed_meta_pixel_view_content’); function voelgoed_meta_pixel_view_content() { if (!function_exists(‘is_product’)) return; if (is_product()) { global $product; if (!$product) return; ?>Continue reading

Add Extra Facebook Pixel

add_filter(‘wpcode_get_snippets_for_location’, function( $snippets, $location ) { if (‘site_wide_header’ === $location ) { foreach ($snippets as $key => $snippet) { if (‘pixel_facebook’ === $snippet->id) { $snippets[$key]->code = str_replace(“fbq(‘init’”, “fbq(‘init’, ‘NEW_PIXEL_ID’); fbq(‘init’”, $snippet->code); } } } return $snippets; }, 12, 2);Continue reading