Last active
August 24, 2025 13:28
-
-
Save zionskynet/64b9a2f4471cfc2bbfa8313bdf2322ab to your computer and use it in GitHub Desktop.
Voluum and CheckoutChamp events tracking integration code. It's based on JavaScript and sends events from a user's browsers. Each piece of code needs to be used on different pages in your CheckoutChamp funnel.
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/first upsell page - Voluum postbacks --> | |
| <script> | |
| document.addEventListener('DOMContentLoaded', async function() { | |
| 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()) { | |
| // const timeStamp = Math.round(Date.now() / 10000); | |
| // let url = getPostbackURL()+'&et=purchase&txid='+timeStamp; | |
| let url = getPostbackURL()+'&et=purchase'; | |
| try { | |
| const orderDataRaw = sessionStorage.getItem("orderData"); | |
| if (orderDataRaw) { | |
| const orderData = JSON.parse(orderDataRaw); | |
| const price = orderData.totalAmount; | |
| url += '&payout='+price; | |
| const orderId = orderData.orderId; | |
| url += '&txid='+orderId; | |
| } | |
| } catch(e) { | |
| console.log('Error: orderData'); | |
| console.log(e); | |
| } | |
| navigator.sendBeacon(url); | |
| } | |
| }); | |
| </script> | |
| <!-- thank-you/first upsell page - Voluum postbacks --> |
Author
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Read full article about Voluum+CheckoutChamp postbacks integration before using this code.