Sending order data to Facebook after checkout

  • Posts: 32
  • Thank you received: 2
  • Hikaserial Subscription Hikashop Business
5 months 1 week ago #361485

-- HikaShop version -- : 5.0.2
-- Joomla version -- : 4.4.0
-- PHP version -- : 8.2

Hi,

we are implementing a Facebook pixel on our website.

We have already found your advice on which HikaShop views to modify in order to send events to Facebook, based on this forum post:
www.hikashop.com/forum/integrations/9040...l-best-practice.html

However, we use a PayPal payment plugin which has a Return URL specified in the configuration. In my understanding, this means that after_checkout view will never load, and we won't be able to send the order data to Facebook from there.

In case we remove this Return URL from the configuration, will PayPal still redirect back to our website and let HikaShop display the default after_checkout view?

We need advice on the best way to proceed in this particular situation.

Thank you

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

  • Posts: 82863
  • Thank you received: 13372
  • MODERATOR
5 months 1 week ago #361486

Hi,

Yes, if you remove the return URL, then PayPal will use the default thank you page of HikaShop : checkout / after_end
So if you have your code in there, it will be triggered.

Note that there is already a Facebook Pixel plugin for HikaShop:
extensions.joomla.org/extension/hikashop...meta-pixel-tracking/
You might want to use it instead of redoing the same thing with a view override and custom code.

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

  • Posts: 32
  • Thank you received: 2
  • Hikaserial Subscription Hikashop Business
5 months 1 week ago #361529

Thank you, we are building this ourselves because the plugin has a few issues.

For testing purposes, I tried adding some custom HTML to after_end.php, but it never showed up.

Then I tried the same with end.php, and it worked.

So in our case, the thank you message rendered at the end comes from end.php, not after_end.php

Is this normal behavior, or is there a case when after_end.php gets loaded?

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

  • Posts: 82863
  • Thank you received: 13372
  • MODERATOR
5 months 1 week ago #361530

Hi,

The end view is called after you click on the "finish" button of the checkout. So this one will always be called when an order is created. But the order is likely not paid at this point.
The after_end view is called after the payment when you're redirected back to your website. But based on the payment plugin you're using and how your payment method is configured, the view might not be called.

The best is to not use a view override. Instead you can develop a plugin and implement the onAfterOrderCreate and onAfterOrderUpdate events of HikaShop, check the status of the order, and based on this, use the offsite conversions tracking to report the sale to Facebook:
developers.facebook.com/docs/meta-pixel/...-offsite-conversions
This way, regardless of how the user is redirected back to the website, the payment plugin being used, etc, the orders will be properly taken into account.

That's actually what we do with the Google Analytics and Matomo plugins available for free on our marketplace.

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

Time to create page: 0.041 seconds
Powered by Kunena Forum