I have had several clients recently asking me how to best implement the Facebook pixel into their Zen cart shop to track customers click through and also track their conversions.

The Facebook pixel code initially is not produced Zen cart friendly. It needs some modifying before the Facebook pixel can be used properly within the Zencart shop to track conversion data.

Once you have created a Facebook pixel within the ads manager of Facebook you will have been given some pixel code which looks similar to this:

<!– Facebook Pixel Code –>
fbq(‘init’, ‘YOUR FACEBOOK NUMBER’);
fbq(‘track’, ‘PageView’);
<noscript><img height=”1″ width=”1″ style=”display:none”
<!– End Facebook Pixel Code –>

This code will work great for tracking Zen cart page views from your Facebook ads when placed at the bottom ofincludes/templates/YOUR-TEMPLATE/common/tpl_main_page.php.

However, if you are running a marketing campaign where you are paying money to Facebook, you definitely want to be able to track the conversion rate of your ads.
For this to happen you will need to make some changes to the Facebook code to work with Zen cart.

We need to add a tracking function to the pixel code which integrates with the Zen cart database variables. We have created this below for you to use within your facebook pixel code.

if($_GET[‘main_page’] == ‘checkout_success’) {
require_once(DIR_WS_CLASSES . ‘order.php’);
$facebook_order = new order($zv_orders_id);
// Purchase
// Track purchases or checkout flow completions (ex. landing on “Thank You” or confirmation page)
fbq(‘track’, ‘Purchase’, {value: ‘‘, currency: ‘‘});

Once this has been added to your pixel code you will be able to see the quantity of purchases through Zen Cart generated through any given ad and also the value!

The image below gives you an example of the data you can view on your ads now.

This will enable you to analyse metrics such as cost per conversion which are absolutely vital to gain a grasp of whether or not your marketing budget is viable.

If you found this article helpful please do share it.

If you are struggling to get your pixel recording conversions we also offer the service to set up facebook pixels on all shopping platforms at £20, please contact us if you require this service.

By | 2018-02-26T23:33:13+00:00 February 26th, 2018|Facebook, Zencart|