Page 1 of 1

Adding Facebook Conversion Tracking to Success Page (OpenCart Version 1.5+)

Posted: Thu Jul 19, 2018 7:57 am
by a.nia
I have added Facebook pixel to header.tpl

I want to add a line of you to the Facebook script when users complete a purchase. Since OpenCart loads same header on all of the pages, I need to somehow find out if the order is completed and success.tpl is loaded, add and extra line to the Facebook pixel.

I have added the following code (used from one other post I saw in the forum) to the header.php:

Code: Select all

if (!empty($this->request->get['route'])) {
    $data['route'] = $this->request->get['route'];
} else {
    $data['route'] = '';
}
and then I have modified the Facebook pixel added to the header.tpl. So, I have added below code in the middle of the Facebook script in the header.tpl. Theoretically, the tracking line should be loaded on the success page, but nothing happens:

Code: Select all

<?php if (!empty($route) && $route == 'checkout/success') { ?>
    //  The extra line has been added here

<?php } ?>
I will be deeply delighted if someone can help on this ASAP.

Thanks,

Re: Adding Facebook Conversion Tracking to Success Page (OpenCart Version 1.5+)

Posted: Tue Nov 27, 2018 9:15 pm
by pixelhaus
Did you find a working solution for this as I'm having the same issue ?

Re: Adding Facebook Conversion Tracking to Success Page (OpenCart Version 1.5+)

Posted: Thu Nov 29, 2018 9:45 pm
by purchasetheme
On success page you have to add the purchase event with the base code of fb pixel then only it will work.