Jump to content

Recommended Posts

Which Hook is the best to use in case from payment from admin if manually added or payment through client itself  

the hook *InvoicePaid just work on manual payment only. 

Share this post


Link to post
Share on other sites

AddInvoicePayment may work but InvoicePaid seems like it should fire no matter how the invoice is paid as long as it gets marked as paid.  If that isn't the case, you may want to file a bug report with WHMCS . 

Share this post


Link to post
Share on other sites

Not sure what you mean?   Could you explain further? 

Those two mentioned hooks do not expect any returns / responses and do not provide output.   If you need the hook to add a statistic / counter to something beyond WHMCS own records, then it needs to be done within the hook and how to do that depends on where you're adding to . 

Share this post


Link to post
Share on other sites
16 hours ago, Waqas Saeed said:

@steven99 thanks, does it supports <<<HTML HTML; ? or echo to track conversion facebook conversion  ? 

No, it doesn't. A quick way to determine if an action hook supports response, is looking at documentation in this specific section.

not-supported.thumb.png.9840e62f829fed2fb71be2dca19198a3.png

In this case, AddInvoicePayment doesn't work for your need. No echo nor <<<HTML. As for Facebook Pixel, you need more than an action hook. Actually integrating it with WHMCS is a nightmere. Not to mention events like "purchase" can trigger on every page load and backspace ruining statistics. And WHMCS doesn't even provide the necessary parameters required for Pixel events.

Edited by Kian

Share this post


Link to post
Share on other sites

Am bit satisfied from this; 'ShoppingCartCheckoutOutput' works little better with facebook pixel. What about OrderPaid hooks but you are right that it does not return output. 

Could you suggest a way out ? @Kian

Share this post


Link to post
Share on other sites

the following script contains facebook conversion code, it works fine and also pixel is able to note the purchases but the problem appear when the user refresh the page many times. eventually, the facebook count the purchases. instead of the one that happened once after payment redirect from the gateway, the callback url returns to the invoice page directly.  somehow, if we can restrict the script to count if it is redirected from only callback url only. 

{if $status eq "Paid" || $paymentSuccessAwaitingNotification || $paymentSuccess || $paymentInititated}
{assign var=total_amt value=$total|replace:'PKR':''|replace:' ':''}

<!-- Facebook Pixel Code -->
{literal}
<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','https://connect.facebook.net/en_US/fbevents.js');
fbq('init', 'xxxxxx'); // Insert your pixel ID here.
fbq('track', 'Purchase', {
 currency: 'PKR',
 value: '{/literal}{$total_amt}{literal}',
});
</script>    
{/literal}
<!-- DO NOT MODIFY -->
<!-- End Facebook Pixel Code -->
{/if}

 

Share this post


Link to post
Share on other sites

It's the same script posted days ago here.

It's obvious that it doesn't work due to reasons I explained here.

 

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


  • Recently Browsing   0 members

    No registered users viewing this page.

×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use & Guidelines and understand your posts will initially be pre-moderated