Facebook Conversion Pixel

  • Posts: 66
  • Thank you received: 2
9 years 1 month ago #193112

-- HikaShop version -- : HikaShop [1310121420]
-- Joomla version -- : 2.5.8
-- PHP version -- : 5.3.29
-- Browser(s) name and version -- : All

Hi, I need to add a Facebook javascript snipet between the <head> </head> tags on the checkout page ../checkout/step/step-4 . It's for tracking visitor conversions originating from a facebook ad. I've read the the howto's on facebook www.facebook.com/help/328988437301229 and there are plugins for wordpress, etc, but nothing for joomla or hikashop. Is there anything that you recommend for this? Or can you offer some ideas for a solution? Thanks guys and I appreciate any input that you have.

Please Log in or Create an account to join the conversation.

  • Posts: 66
  • Thank you received: 2
9 years 1 month ago #193115

So, I read further on this and facebook recommends putting the code between the <head> </head> tags, but you can put it in the page. I went to hikashop admin and display --> views --> checkout / after_end.php and I can drop the code above the <?php tag at the top. Is this the correct views file or should it be on checkout / end.php ?

Please Log in or Create an account to join the conversation.

  • Posts: 81540
  • Thank you received: 13071
  • MODERATOR
9 years 1 month ago #193442

Hi,

You can indeed add that code at the beginning of the after_end view file but that will only work if you're using a payment method which redirect to the payment gateway payment page and then redirect back to your website and without a return URL configured.
For the other payment methods where there is not a redirection to the payment gateway for the payment, you can add your code in the end view file.
For the first type of payment methods, you can also add the code in the end file, but as that view is displayed before the redirection to the payment gateway, the order won't have been paid yet when the conversion pixel displays.

Please Log in or Create an account to join the conversation.

  • Posts: 28
  • Thank you received: 1
8 years 11 months ago #200352

Hello:

I am having the same problem. I have added the pixel code to the beginning of the after_end view file, but on Facebook it is showing that my pixel is not verified.

My site is using the Paypal's Adaptive Payment as the payment method. Should I be putting the codes into a different part of a different file instead?

Please Log in or Create an account to join the conversation.

  • Posts: 81540
  • Thank you received: 13071
  • MODERATOR
8 years 11 months ago #200379

Hi,

If you put it in the after_end file, the pixel will only display after the customer click on the "go back to the shop" link at the end of the PayPal payment (the redirection can be automated with a setting of your PayPal account).
If the user doesn't click on it, the pixel won't display and thus you won't get anything in Facebook.
You can alternatively put it in the "end" view file and in that case it will display before the redirection to PayPal for the payment (so you might get orders which won't be paid in your conversion statistics).

Please Log in or Create an account to join the conversation.

  • Posts: 28
  • Thank you received: 1
8 years 11 months ago #200455

Hello:

Thank you. I will give that a try!

Please Log in or Create an account to join the conversation.

  • Posts: 78
  • Thank you received: 3
8 years 2 months ago #229489

There is a line in the Facebook Conversion code that needs to be changed to make the value dynamic. How can I get this to work with HikaShop?

{'value':'0.01','currency':'USD'}])

Please Log in or Create an account to join the conversation.

  • Posts: 81540
  • Thank you received: 13071
  • MODERATOR
8 years 2 months ago #229538

You could do like that:

<?php
if(!defined('DS'))
 define('DS', DIRECTORY_SEPARATOR); if(!include_once(rtrim(JPATH_ADMINISTRATOR,DS).DS.'components'.DS.'com_hikashop'.DS.'helpers'.DS.'helper.php')) return true;

$app =JFactory::getApplication();
$order_id = $app->getUserState('com_hikashop.order_id');
$orderClass = hikashop_get('class.order');
$order = $orderClass->get($order_id);
$currencyClass = hikashop_get('class.currency');
$currency_id = intval($order->order_currency_id);
$currency = $currencyClass->getCurrencies($currency_id, $null);
echo "{'value':'".$order->order_full_price."','currency':'".$currency[$currency_id]->currency_code."'}])";
?>

Please Log in or Create an account to join the conversation.

  • Posts: 100
  • Thank you received: 2
7 years 8 months ago #247461

HI Nicolas

I just want to make sure I understand correctly.

According to the facebook pixel tutorials that I have gone through the tracking code is placed after the fbq('track', "PageView"); but before the </script> tag

fbq('track', "PageView");
fbq('track', 'Purchase', {value: '0.00', currency:'ZAR'});
</script>

Where would I insert your code

Please Log in or Create an account to join the conversation.

  • Posts: 81540
  • Thank you received: 13071
  • MODERATOR
7 years 8 months ago #247492

Hi,

You need to add the whole javascript code in the file "after_end" via the menu Display>Views. So you would insert the code proposed instead of the piece: {value: '0.00', currency:'ZAR'}
So that this would be dynamically filled by the code proposed.

Please Log in or Create an account to join the conversation.

Time to create page: 0.100 seconds
Powered by Kunena Forum