ðMagic Boost - Integration and Tracking
Last updated
Last updated
With Magic Boost, we can track offers via either 'Pixel Integration', 'Post-Back URL' or making an API call.
We have successfully integrated with Impact.com and AppsFlyer. Therefore, if you are using AppsFlyer or Impact.com, this guide is not necessary.
When a user clicks on an affiliate link generated through the Magic Boost Platform, they are redirected to your landing page.
This URL carries a 'visit id' that associates the current user with an affiliate account.
The URL will appear like this: https://URL.com?vid=<Your visit id>.
The subsequent step involves saving the visit ID to the browser's cookies so that it can be utilized across the entire website.
This code must execute as soon as the user arrives at your landing page or website, without any conditions.
Following this, you will need to create a 'getCookie' method to extract the relevant cookie:
Now when we have the VisitID, we will define 2 actions/events/goals for the campaign and set the tracking.
Actions/Events/Goals can include:
User Registration:
Registration with email or connection of a wallet
User App Installation:
Can be an Android or iOS app
User KYC Verification
User Deposit
User Trading:
Can involve any token or a specific token
User Purchasing:
Can involve any token, a specific token, or NFT
User Swapping:
Can involve any token or a specific token
User Staking:
Can involve any token or a specific token
And any other measurable performance actions.
We will illustrate this with the following example: 'User Registers and Connects a Wallet'."
â?action=3â - this denotes the action for Registration.
We will illustrate this with the following example: 'User needs to Purchase X amount of Tokens'.
â?action=7â - this represents the second action, such as buy/swap, etc.
So, the offer here would be:
Upon clicking the link, visits to the landing page or offer are counted.
The second action is triggered when the user registers successfully.
The third action is completed when the user successfully purchases X amount of tokens.
Prerequisites: Before you begin, make sure you have:
A basic understanding of JavaScript.
Access to your website's frontend and backend codebase.
Obtain the vid
Parameter: When a user is redirected to your website, a vid
parameter will be included in the URL. You need to extract this parameter.
You can integrate our script, https://api38.magicsquare-web.com/vid.js, on your page. This script retrieves the 'VID' from the LP URL and saves it into a browser cookie.
Pixels
The pixel script retrieves the visit id from the cookies and sends it to us. This enables our platform to recognize that a Registration or a Deposit event has occurred.
Important:
You can incorporate our script, https://api38.magicsquare-web.com/pixel.js, on your 'success registration' page. This script takes the 'VID' from the cookies and sends it to our CRM.
Alternatively, you can devise your own method to send a registration pixel with visit_id to the CRM endpoint:
Fire the Pixel: Once you have the vid
, you can proceed to fire the pixel by making an HTTP GET request to your backend.
Extract the vid
Parameter: In your backend, you'll need to extract the vid
parameter from the incoming request.
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>
For the Lead or Sale pixels (Registration or Deposit), we need to receive the identical visit_id. This way, we can confirm that the action was undertaken during the current visit.
Browser cookies are tied to a specific domain. If your Landing Page (LP) is on domain X but the registration/deposit script is on domain Y, it's impossible to transfer the visit_id through cookies.
In such a scenario, you can transfer the VID from domain X to domain Y as a URL parameter (like Y?vid={visit_id}). Subsequently, on your registration (or deposit) page, add vid.js before pixel.js (or pixel_deposit.js). This script takes the vid URL and saves it into a browser cookie.
Once you have the vid
, you can also make an API call to MagicBoost to register the pixel.
Pixel Types:
CPPA Pixels: Use action=7
in the API URL.
CPPL Pixels: Use action=3
in the API URL.
That's it! You've successfully implemented the MagicBoost Pixel in both the frontend and the backend. If you have any further questions or run into issues, feel free to reach out for support.