It is possible to send a transaction to the affiliate program using Basket through a server-sided tracking call. The easy.MARKETING system provides a call that needs to be filled with the corresponding data. Since it is server-side tracking, the tracking-relevant ID of the user needs to be sent back from the advertiser's server to the system.
This ID (also referred to as "emid" below) can be appended to the click link in the frontend of the system; see here for more information: https://easy-m.freshdesk.com/support/solutions/articles/48000985565-kampagnen-kontrollzentrum
The basket is passed as an array in JSON format in the GET parameter "json=" to the endpoint. Below, we provide an example PHP snippet in the documentation.
It is important to populate the basket array with the data for each ordered position.
Endpoint
https://SUB-DOMAIN/trck/ebasket/
Example tracking call
Conversion call - Serversided |
---|
https://DOMAIN*/trck/ebasket/?json=[{"campaign_id":"CAMPAIGN_ID","trigger_id":"TRIGGER_ID","token":"TOKEN","emid":"EMID","amount":"AMOUNT","price":"PRICE","article_number":"ARTICLE_NUMBER","productname":"PRODUKTNAME","category":"CATEGORY","additional":{"VARIABLE":"VALUE","VARIABLE2":"VALUE2"}}] |
JSON structure
[ { "campaign_id": "CAMPAIGN_ID", "token": "TOKEN", "trigger_id": "TRIGGER_ID", "action_id": "EMID", "amount": "AMOUNT", "price": "PRICE", "article_number": "ARTICLE_NUMBER", "productname": "PRODUCT_NAME", "category": "CATEGORY", "additional": { "vouchercode": "WINTER20", "zusatzinfo": "additional_1" } } ]
Variable description
VARIABLE | DESCRIPTION |
CAMPAIGN_ID* | Stores the campaign ID. |
TRIGGER_ID* | Stores the trigger ID. |
TOKEN* | Stores the order number / order ID. |
EMID* | It is filled with the value of the "emid" parameter, which is passed from easy.affiliate to the landing page through the click link. This value is essential for attribution, as it provides the customer journey information. |
AMOUNT* | Replaced with the quantity of times the corresponding product was purchased. |
PRICE* | It is filled with the NET price of the individual product. The separator for Euro and cent is dot ('.'). |
ARTICLE_NUMBER* | It is filled with the respective product ID. |
PRODUCTNAME* | It is filled with the product name. |
CATEGORY* | Stores the product category. |
ADDITIONAL | The "additional" parameter can include another array with additional values relevant to the customer case. |
Values marked with * are mandatory.
Coupon implementation
In many shops, users are offered coupons to provide discounts. Often, these coupons are taken into account in the calculation of remunerations.
Discount coupons:
For discount coupons, an additional basket item is added within the JSON parameter. The amount to be deducted is specified as a negative turnover.
Example tracking call with coupon item
https://SUB-DOMAIN*/trck/ebasket/?json=[{"campaign_id":"CAMPAIGN_ID","trigger_id":"TRIGGER_ID","token":"TOKEN","action_id":"EMID","amount":"AMOUNT","price":"PRICE","article_number":"ARTICLE_NUMBER","productname":"PRODUKTNAME","category":"CATEGORY","additional":{"VARIABLE":"VALUE","VARIABLE2":"VALUE2"}},{"campaign_id":"CAMPAIGN_ID","trigger_id":"TRIGGER_ID","token": "TOKEN","emid":"","amount":"AMOUNT","price":"DISCOUNTPRICE","article_number":"VOUCHER_NUMBER","productname":"VOUCHER_NAME","category":"VOUCHER_CATEGORY","additional":{"VARIABLE":"VALUE","VARIABLE2":"VALUE2"}}] |
JSON structure of a coupon item
[ { "campaign_id": "CAMPAIGN_ID", "token": "TOKEN", "trigger_id": "TRIGGER_ID", "action_id": "EMID", "amount": "AMOUNT", "price": "DISCOUNTPRICE", "article_number": "VOUCHER_NUMBER", "productname": "VOUCHER_NAME", "category": "VOUCHER_CATEGORY", "additional": { "VARIABLE": "VALUE", "VARIABLE2": "VALUE2" } } ]
Implementation in PHP
PHP code example that can be integrated on the order confirmation page:
<?php $basket = []; $positions = $Shopsystem->getOrderedPositions(); // Get all ordered positions from the shop system $emid = $Shopsystem->getEmid(); // Get EMID from the shop system foreach ($positions as $position) { // For each ordered position $basketItem = [ 'campaign_id' => 1, 'trigger_id' => 1, 'token' => $Shopsystem->ordernumber, // Order number from the shop system 'action_id' => $emid, // EMID passed from the easy.MARKETING system via the click 'amount' => $Shopsystem->positionAmount, // Ordered quantity of the position 'price' => $Shopsystem->positionPrice, // Price of the ordered position 'article_number' => $Shopsystem->articleNumber, // Article number of the ordered position 'productname' => $Shopsystem->productName, // Product name of the ordered position 'category' => $Shopsystem->category, // Category of the ordered position 'additional' => [ 'vouchercode' => $Shopsystem->vouchercode, // Example: Used voucher code in the order 'customerType' => $Shopsystem->customerType, // Custom values that can be freely filled // .... ] ]; $basket[] = $basketItem; } // Constructing the tracking URL $endpoint = 'https://DOMAIN/trck/ebasket/'; $getParameter = [ 'json' => json_encode($basket), ]; $trackingUrl = $endpoint . '?' . http_build_query($getParameter); // Calling the tracking URL via wget; any other client can be used here as well. exec('wget -O /dev/null "' . $trackingUrl . '"'); If a currency other than EUR is used, it can be added as a GET parameter. Example: 'json' => json_encode($basket), 'currency' => 'CHF'
In this case, the $Shopsystem
object represents the advertiser's shop that provides the values.