Post by a.nia » Thu Jul 19, 2018 7:57 am

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,

Newbie

Posts

Joined
Thu Jul 19, 2018 7:27 am

Post by pixelhaus » Tue Nov 27, 2018 9:15 pm

Did you find a working solution for this as I'm having the same issue ?

New member

Posts

Joined
Mon Sep 26, 2011 3:57 pm

Post by purchasetheme » Thu Nov 29, 2018 9:45 pm

On success page you have to add the purchase event with the base code of fb pixel then only it will work.

PURCHASETHEME.COM
Facebook Pixel Code & Facebook Conversion Code
https://www.opencart.com/index.php?rout ... n_id=28804


User avatar
Newbie

Posts

Joined
Tue Jun 05, 2018 10:43 pm

Who is online

Users browsing this forum: No registered users and 15 guests