Closed albsa closed 8 years ago
Thank you @albsa for submitting this request. We take care of it as soon as possible
Alex
Hi @bordeo Thanks for your reply! Do you have a quickfix that I can apply for now?
No sorry i hadn't develop the last feature, i can't find a solution quickly. If you find the solution we can accept the pull request.
Hi @bordeo
I fixed it for now myself with this adjustment:
<?php
/**
* pixel.phtml
*
* @category Magento_Module
* @package Hevelop_FacebookPixel
* @author Simone Marcato <simone@hevelop.com>
* @license http://opensource.org/licenses/agpl-3.0 GNU Affero General Public License v3 (AGPL-3.0)
* @link https://github.com/Hevelop/Facebookpixel
*/
?>
<?php $helper = Mage::helper('hevelop_facebookpixel'); ?>
<?php if ($helper->isEnabled()): ?>
<?php $pixelId = $helper->getPixelId() ?>
<!-- Facebook Pixel Code -->
<script>
!function (f, b, e, v, n, t, s) {
if (f.fbq)return;
n = f.fbq = function () {
n.callMethod ?
n.callMethod.apply(n, arguments) : n.queue.push(arguments)
};
if (!f._fbq)f._fbq = n;
n.push = n;
n.loaded = !0;
n.version = '2.0';
n.queue = [];
t = b.createElement(e);
t.async = !0;
t.src = v;
s = b.getElementsByTagName(e)[0];
s.parentNode.insertBefore(t, s)
}(window,
document, 'script', '//connect.facebook.net/en_US/fbevents.js');
fbq('init', '<?php echo $pixelId?>');
fbq('track', "PageView");
<?php if($helper->isCheckout()):?>
fbq('track', "InitiateCheckout");
<?php endif; ?>
<?php $pageIdentifier = Mage::app()->getFrontController()->getAction()->getFullActionName();?> /* this identifier value will change as per page.so echo this variable so you will get page identifier on all pages*/
<?php if($pageIdentifier == 'checkout_onepage_success'):?>
<?php $orderTracking = $this->getOrdersTrackingCode(); ?>
<?php if($orderTracking):?>
// order tracking
<?php echo $orderTracking ?>
// order tracking
<?php endif; ?>
<?php endif; ?>
</script>
<noscript><img height="1" width="1" style="display:none"
src="https://www.facebook.com/tr?id=<?php echo $pixelId ?>&ev=PageView&noscript=1"
/>
</noscript>
<?php endif; ?>
For so far I could see the $ordersTracking only fired a purchase event, so I made it like this that it only runs on the success page.
The data that is reported in Facebook untill now is 100% correct.
Hi @albsa ,
I'm glad you successfully fixed the issue, but unluckily we cannot integrate this change in the repo since it seems there's something in your installation that fires _checkout_onepage_controller_successaction event in an unexpected way.
You can see in in config.xml how it's configured and in Observer.php how it's implemented.
I suggest you to debug setFacebookPixelOnOrderSuccessPageView method to understand what is setting order_ids on facebookpixel block.
Hope this will help :) S
Hi guys,
Thank you for this great module. However, there is a bug when I add a product from the category page.
When it's loading the cart page after adding to cart, Facebook Pixel helper is showing a Purchase event.
I am using module 1.5 and Magento 1.9.2.2