DennisHermannsen Posted September 10, 2018 Share Posted September 10, 2018 Hi, Any ideas how this could be accomplished? We need different tracking pixels on 'order complete' for different products. If client buys and pays for Product A, one pixel should be shown in the code. If client buys and pays for Product B, some other pixel should be shown. I'm trying to add this as a hook, but I'd really appreciate some help. It should also be said that the pixel should be visible on a page that will always be shown after client has paid for the invoice. 0 Quote Link to comment Share on other sites More sharing options...
Kian Posted September 11, 2018 Share Posted September 11, 2018 With an action hook that adds the necessary javascript to complete order page. Something like follows: <?php function customPrefix_ClientAreaPage($vars) { if (($vars['filename'] == 'cart') AND ($_GET['a'] == 'complete')) { $pid = '1'; // Select IDs of all products/services on invoice with a query and add as many 'contents' you need in tracking code echo "<script>fbq('track', 'Purchase', { contents: [{ id: '{$pid}', quantity: 1, item_price: 0 }], });</script>"; } return $output; } add_hook('ClientAreaPage', 10, 'customPrefix_ClientAreaPage'); 0 Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.