FunnelKit
FunnelKit Documentation
Get unstuck with our helpful reference material

Funnel Builder

Change Content ID Format for Facebook Event Tracking

This document provides a step-by-step guide on how to modify the content_id format for tracked events in FunnelKit. The goal is to send the content_id in the format of SKU_ID to Facebook for accurate event tracking.

Steps to Change Content ID Format

Step 1: Access the Custom Code Snippet

To change the content_id format to SKU_ID for Facebook event tracking, use the following custom code snippet:

Custom Code Snippet: Change Content ID Format Snippet

add_filter( 'wfocu_get_product_content_id', 'wffn_send_prefix_content_id', 10, 2 );
add_filter( 'wffn_get_product_content_id', 'wffn_send_prefix_content_id', 10, 2 );


function wffn_send_prefix_content_id( $content_id, $product_id ) {

	$content_id_sku = get_post_meta( $product_id, '_sku', true );
	$content_id     = $content_id_sku . '_' . $product_id;

	return $content_id;
}

Step 2: Add the Snippet to Your Site

If you want Facebook Pixel/Conversions API to send SKU instead of Product ID (content_id), you can add a small code snippet either through a custom plugin or by pasting it into your theme’s functions.php file (preferably in a child theme, so updates won’t wipe it out).

After applying this snippet, the content_id for tracked events will appear in the format: SKU_ID.

Conclusion

By following these steps, you can change the content_id format to SKU_ID for your Facebook event tracking. This ensures that Facebook receives the correct content identification for your products.

Ready to Transform Your Store?
Join 38,315+ successful store owners who trust FunnelKit to power their businesses.
Conversion Optimized Checkout Pages
Increase Revenue with Smart Upsells
Capture Emails & Recover Abandoned Carts
Automate Winbacks & Repeat Sales
918+ 5 star reviews on WordPress.org
Transform your store to power your business with FunnelKit
🚀 Maximize Your Profit with FunnelKit – Highest Rated with 918+ 5-Star Reviews
Get Started