Hi all,
I have my fb pixel code before the </head> tag in /catalog/view/theme/default/template/common/header.tpl so it runs on all pages.
I would like to add the purchase tracking code fbq('track', 'Purchase', {value: '0.00', currency: 'USD'}); only on checkout/checkout page just under fbq('track','PageView'); just as in the attached file.
I tried adding this to the pixel but it did not work:
if (isset($this->request->get['route']) && $this->request->get['route'] == 'checkout/checkout') {
fbq('track', 'Purchase', {value: '0.00', currency: 'USD'});
}
i got the following error in the pixel helper extension:
"The Facebook pixel code on this page didn't load, so no information was sent to Facebook"
How can i add the purchase tracking line to the checkout page only?
Appreciate your help!
I have my fb pixel code before the </head> tag in /catalog/view/theme/default/template/common/header.tpl so it runs on all pages.
I would like to add the purchase tracking code fbq('track', 'Purchase', {value: '0.00', currency: 'USD'}); only on checkout/checkout page just under fbq('track','PageView'); just as in the attached file.
I tried adding this to the pixel but it did not work:
if (isset($this->request->get['route']) && $this->request->get['route'] == 'checkout/checkout') {
fbq('track', 'Purchase', {value: '0.00', currency: 'USD'});
}
i got the following error in the pixel helper extension:
"The Facebook pixel code on this page didn't load, so no information was sent to Facebook"
How can i add the purchase tracking line to the checkout page only?
Appreciate your help!
Attachments
11409193_1605465096376853_497323941_n.jpg (193.38 KiB) Viewed 2184 times
$this->request->get is not available inside template files. Use $_GET method directly instead.fantastico wrote: I tried adding this to the pixel but it did not work:
if (isset($this->request->get['route']) && $this->request->get['route'] == 'checkout/checkout') {
fbq('track', 'Purchase', {value: '0.00', currency: 'USD'});
}
Code: Select all
<?php if (isset($_GET['route']) && $_GET['route'] == 'checkout/checkout') { ?>
fbq('track', 'Purchase', {value: '0.00', currency: 'USD'});
<?php
}
?>
XForm - Opencart Form Builder
Xshippingpro - An advanced Shipping Module
Need Professional support? Skype: opencartmart
You are welcome!
XForm - Opencart Form Builder
Xshippingpro - An advanced Shipping Module
Need Professional support? Skype: opencartmart
Who is online
Users browsing this forum: No registered users and 43 guests