Set up payment attribution
Payment attribution lets you identify which content creator referred a user who made a purchase. All purchases made by that user are attributed to that content creator, ensuring they receive the correct campaign payouts.
How it works
To enable attribution, use the tracking_id parameter.
The tracking_id is a unique identifier that is used to:
- track the performance of campaigns
- identify which creator referred the user
- collect analytics in Partner Network
- correctly calculate rewards and payouts
When a user follows a content creator’s personal link, Xsolla generates a unique 32-character tracking_id and appends it to the URL of the destination page. The destination can be any landing page associated with selling products. Pass the generated tracking_id in the request to generate a payment token. After the transaction is completed, the tracking_id is stored with the payment data and is used for attribution, analytics, and financial calculations.
Example of a link with a tracking_id parameter: https://webshop-external-demo.xsolla.site/?tracking_id=abcdefghijklmnopqrstuvwxyz123456
tracking_id, the payment can’t be attributed to a traffic source. Such payments aren’t included in the performance report and aren’t considered when calculating payouts to the creator.To pass tracking_id when generating a payment token:
- Get the tracking_id from the query parameters in the URL.
- Save it to the browser’s
localStorage. - Include tracking_id in the request to generate the payment token.
Get tracking_id
Retrieving the tracking_id on the client side depends on your integration type. You can either implement your own logic to extract the tracking_id or use the Partner Network script provided by Xsolla. Payment attribution works the same regardless of the type of sales pages, including storefronts, individual items or game key pages, and multi-game catalogs.
tracking_id may be lost.This script automatically extracts tracking_id from the URL’s query parameters and saves it to localStorage. To retrieve the stored value, the getTrackingId() method is provided, which is called when generating a payment token.
Detailed implementation examples are provided in the tabs below.
Regardless of how you integrate it — using the JavaScript snippet or the Partner Network script — call XsollaPartnerNetwork.getTrackingId() to retrieve the stored tracking_id:
- javascript
1const trackingId = XsollaPartnerNetwork.getTrackingId();
2if (trackingId) {
3 console.log('Saved tracking_id from URL:', trackingId);
4 // add tracking_id into your request parameters
5}
Pass tracking_id when generating payment token
Depending on how you set up your integration, use one of the options below to pass the tracking_id to the token generation method.
tracking_id is included in the token request.Found a typo or other text error? Select the text and press Ctrl+Enter.