Jump to content

Hook


Waqas Saeed

Recommended Posts

  • 2 weeks later...

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 . 

Link to comment
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
Link to comment
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}

 

Link to comment
Share on other sites

  • 3 weeks later...
2 hours ago, evolve hosting said:

Is it ad related?

Yes

2 hours ago, evolve hosting said:

Question from a non facebook user: What's the point of syncing order data with Facebook?

For tracking the ROI of Facebook ads and A/B testing campaigns.

Edited by Kian
Link to comment
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