Last active
August 24, 2025 14:45
-
-
Save zionskynet/8c1befe64fa32dd96c92b403e6f99567 to your computer and use it in GitHub Desktop.
Voluum and Funnelish Events Tracking Integration. JavaScript and Server-Side (PHP) Tracking Code for sending "begin checkout" and "purchase" events
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <!-- sale page/user entry point - Voluum postbacks --> | |
| <script> | |
| document.addEventListener('DOMContentLoaded', async function(event) { | |
| try { | |
| const url = new URL(window.document.location.href), | |
| utmMedium = url.searchParams.get('utm_medium'), | |
| xoClickId = url.searchParams.get('utm_term'); | |
| if (utmMedium === 'xo' && xoClickId) { | |
| // init user data | |
| localStorage.setItem('utmMedium', utmMedium); | |
| localStorage.setItem('xoClickId', xoClickId); | |
| } | |
| } catch(e) { | |
| console.log(e); | |
| } | |
| }); | |
| </script> | |
| <!-- sale page/user entry point - Voluum postbacks --> | |
| <!-- checkout page - Voluum postbacks --> | |
| <script> | |
| document.addEventListener('DOMContentLoaded', async function(event) { | |
| function getPostbackURL() { | |
| try { | |
| const utmMedium = localStorage.getItem('utmMedium'); | |
| const xoClickId = localStorage.getItem('xoClickId'); | |
| if (utmMedium === 'xo' && xoClickId) { | |
| return 'https://your-voluum.domain/postback?cid='+xoClickId; | |
| } | |
| } catch(e) { | |
| console.log(e); | |
| } | |
| } | |
| if (getPostbackURL()) { | |
| navigator.sendBeacon(getPostbackURL()+'&et=begin_checkout'); | |
| } | |
| }); | |
| </script> | |
| <!-- checkout page - Voluum postbacks --> | |
| <!-- thank-you/upsale page - Voluum postbacks --> | |
| <script> | |
| document.addEventListener('DOMContentLoaded', async function(event) { | |
| function getPostbackURL() { | |
| try { | |
| const utmMedium = localStorage.getItem('utmMedium'); | |
| const xoClickId = localStorage.getItem('xoClickId'); | |
| if (utmMedium === 'xo' && xoClickId) { | |
| return 'https://your-voluum.domain/postback?cid='+xoClickId; | |
| } | |
| } catch(e) { | |
| console.log(e); | |
| } | |
| } | |
| if (getPostbackURL()) { | |
| navigator.sendBeacon(getPostbackURL()+'&et=purchase'); | |
| } | |
| }); | |
| /* | |
| for purchase postbacks with payout use Funnelish "Automations" and a PHP middleware | |
| */ | |
| </script> | |
| <!-- thank-you/upsale page - Voluum postbacks --> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?php | |
| $rawData = json_decode(file_get_contents('php://input'), true); | |
| if (!isset($rawData['meta']) || !isset($rawData['meta']['utm_medium']) || !isset($rawData['meta']['utm_term'])) { | |
| return; | |
| } | |
| if ($rawData['meta']['utm_medium'] !== 'xo') { | |
| return; | |
| } | |
| $url = 'https://your-voluum.domain/postback?cid='.$rawData['meta']['utm_term'].'&et=purchase&payout='.$rawData['products'][0]['amount'].'&txid='.$rawData['id']; | |
| $vlmResp = file_get_contents($url); |
Author
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
You can send a "purchase" event without revenue value via JavaScript, or you can use Funnelish "Automations" option and a PHP as middleware for sending "purchase" event with revenue value.
Read full article about Voluum+Funnelish postbacks integration before using this code.