Magic Boost - Integration & Tracking With Magic Boost, we can track the offers either with a “Pixel Integration” or a “Post-Back URL”. We are successfully integrated with Impact.com & AppsFlyer , so if you are using AppsFlyer or Impact.com - this guide is not needed. 1) Using a Post-Back URL To Track Conversions ● When a user clicks an affiliate link generated through the Magic Boost Platform, he will be redirected to your landing page. ● The URL will carry a “visit id” which can relate the current user with an affiliate account. ○ The URL will look like this: https://URL.com ?vid=<Your visit id> ● The next step is to save the visit ID to the browser’s cookies so that it can be used across the entire website. Save VisitID //check for vid in url parameter const paramsVid = newURLSearchParams(window.location.search).get('vid'); //if the vid is not saved in the cookies we save it if (paramsVid && document.cookie.indexOf('vid=') === -1) { document.cookie = "vid=" + paramsVid + "; path=/;"; } ● This code has to run when the user arrives at your landing page/website, without any conditions. ● Then you will need to create a “getCookie” method to extract the relevant cookie: GetCookie function getCookie(cookieName) { var cookieString=RegExp(cookieName+"=[^;]+").exec(document.co okie); return decodeURIComponent(!!cookieString ? cookieString.toString().replace(/^[^=]+./,"") : ""); } ● Now when we have the VisitID, we will define 2 actions/events/goals for the campaign and set the tracking. ○ Actions/Events/Goals can be - ■ User Registers ● Registers with Email or Connects a Wallet ■ User Install App ● Can Be Android/iOS App ■ User Gets KYC Verified ■ User Deposit ■ User Trade ● Either any token, or specific token ■ User Buy ● Either any token, or specific token ● Or NFT ■ User Swap ● Either any token, or specific token ■ User Stake ● Either any token, or specific token ■ And any other performance action that we can measure. Define and Set Tracking for “First Action” - for example: “User Registers and Connects a Wallet”. function registerLead() { const baseUrl = 'https://magic.lol/4bbad3f1' const vid = getCookie('vid') if (vid) { fetch(`${baseUrl}/brokers/pixel?action=3&vid=${vid}`) .then((result) => { //successful request alert("Request was sent, Thank you.") }) .catch((err) => { //failed request console.error("Failed to register") }) }else { //cookie doesn't exist } } ● “?action=3” this is the action for Registration Define and Set Tracking for “Second Action” for example: “User needs to Purchase/Buy X amount of Tokens”. const depositBtn = document.getElementById('deposit'); const baseUrl = 'https://magic.lol/4bbad3f1'; depositBtn.addEventListener("click", () => { //retrive the visit id from the cookies const vid = getCookie('vid') if(vid){ fetch(`${baseUrl}/brokers/pixel?action=7&vid=${vid}`) .then((result) => { //Call was created successfully }) .catch((err) => { //Call failed }) }else { //cookie doesn't exist } }) ● “?action=7” this is the action for 2nd action like buy/swap etc. So the Offer here would be: 1. After Clicking on the link - it will count Visits to the landing page / offer 2. The second action would be that the user successfully registered. 3. Third Action, would be that the user successfully bought X amount of tokens. 2) Using Pixels To Track Conversions Visit ID When we create a link we save all the user data (affiliate, offer, IP, user agent, etc) in the “visit” entity. This entity id - visit_id (vid) we add at the end of the LP URL. You can add to your page our https://api38.magicsquare-web.com/vid.js script that takes a VID from the LP URL and saves it into a browser cookie. Pixels The pixel script takes the visit id from the cookies and sends it to us, so our Platform knows that a Registration or a Deposit event happened. Important: You can add to your “success registration” page our https://api38.magicsquare-web.com/pixel.js script that takes the VID from the cookies and sends it to our CRM. Or you can implement your own way to send a registration pixel with visit_id to the CRM endpoint: GET https://magic.lol/4bbad3f1/brokers/pixel?action=3&vid={visit_id} The pixels to implement based on the different events you want to track: Click Pixel - Place on the Initial Landing Page: <script src="https://api38.magicaffiliates.io/vid.js"></script> Lead/Registration Pixel - Place on the Success/Thank you Page to track registrations: <script src="https://api38.magicaffiliates.io/vid.js"></script> <script src="https://api38.magicaffiliates.io/pixel.js"></script> SALE/Purchase Pixel - Place on the Success/Thank you Page to track sales/conversions: <script src="https://api38.magicaffiliates.io/vid.js"></script> <script src="https://api38.magicaffiliates.io/pixel_deposit.js"></script> Important Notes: 1) With the Lead or Sale pixels (Registration or Deposit) we need to receive the same visit_id, and then we know that the action was done for the current visit. 2) Browser cookies are associated with a domain. If your LP is on domain X but the registration/deposit script is on domain Y, you can’t transfer the visit_id through cookies. In this case, you can transfer the VID from X to Y domains as URL param. (like Y?vid={visit_id} ). And then on your registration (or deposit) page before pixel.js (or pixel_deposit.js) you add vid.js, which takes the vid URL and saves it into a browser cookie.