E-commerce

Web client integration can be done via GTM Tag or by adding inline JavaScript.

API Base URL

Testing:

https://winfluenced-pixel-rvlaoxgvjq-ey.a.run.app

Test Api Swagger Url:

https://winfluenced-pixel-rvlaoxgvjq-ey.a.run.app/swagger/index.html

Sample Client script

<script>
  var transactionData = {
    customer_no: {{User - Customer ID}},
    order_no: {{Ecommerce - UA - Transaction - ID}},
    basket_items: {{Ecommerce - All}},
    order_tax: Math.floor({{cd_order_tax}}).toFixed(2),
    order_shipping: Math.floor({{Ecommerce - Purchase - Shipping}}).toFixed(2),
    order_total_discount: null,
    order_total: Math.floor({{Ecommerce - Purchase - Revenue}}).toFixed(2),
    voucher_code: {{Ecommerce - Purchase - Coupon Code}},
    user_type: '',
    sales_channel: ''
};

(function sendConversion() {
    function getAdpCookieValue(cookieName, i) {
        var cookieValue = document.cookie.match(new RegExp('(^| )' + cookieName + '=([^;]+)'));
        var values = (cookieValue ? cookieValue.pop() : '').split('_');
        return (values.length >= i) ? values[i] : '';
    }

    var conversion_data = {
        "transactionId": getAdpCookieValue("_adp", 0), // ClickID reads from _adp cookie
        "offerId": getAdpCookieValue("_adp", 1),  // OfferID reads from _adp cookie
        "advertiserId": "{Advertiser ID}", // Replace with the brand Advertiser ID provided by Adpartners
        "goalName": null, // Optional 
        "buyerId": transactionData.customer_no,
        "orderNo": transactionData.order_no,
        "basketItems": [],
        "totalDiscount": transactionData.order_total_discount,
        "totalShippingAmount": transactionData.order_shipping,
        "totalTax": transactionData.order_tax,
        "totalAmount": transactionData.order_total,
        "voucherCode": transactionData.voucher_code,
        "userType": transactionData.userType,
        "salesChannel": transactionData.salesChannel
    }
    for (i = 0; i < transactionData.basket_items.purchase.products.length; i++) {
        conversion_data.basketItems.push({
            "skuId": transactionData.basket_items.purchase.products[i].id,
            "sellerId": transactionData.basket_items.purchase.products[i].dimension98,
            "productType": '',
            "productName": transactionData.basket_items.purchase.products[i].name,
            "categoryName": transactionData.basket_items.purchase.products[i].category,
            "quantity": parseInt(transactionData.basket_items.purchase.products[i].quantity),
            "brandName": transactionData.basket_items.purchase.products[i].brand,
            "discountedAmount": {{2- cJS - Product price Array - Purchase - GelirOrtakları}},
            "unitePrice": null,
            "uniteDiscount": null
        });
    }
    if(conversion_data.transactionId && conversion_data.transactionId != '')
    {
      fetch('{API Base URL}/api/pixel/ecomm', {
        method: "POST",
        body: JSON.stringify(conversion_data),
        headers: {
            "Content-Type": "application/json"
        },
      });
    }
})();
</script>
circle-info

Conversion Endpoint: Conversion pixel will send a post request with conversion data the following API method. You may find the schema and field properties bellow.

Create Conversion API Action

Conversion tracking for e-commerce order transactions.

post
Body
transactionIdstring · nullableOptional

Click - Transaction Id

advertiserIdstring · nullableOptional

Advertiser Adpartners ID

buyerIdstring · nullableOptional

Customer number

offerIdstring · nullableOptional

Offer id, (Optional)

goalNamestring · nullableOptional

Category base, commission goal name, (Optional)

orderNostring · nullableOptional

Conversion no, Order no

totalDiscountnumber · float · nullableOptional

Order total discount

totalShippingAmountnumber · float · nullableOptional

Order total shipping amount

totalTaxnumber · float · nullableOptional

Order total tax

totalAmountnumber · float · nullableOptional

Order total amount, (include tax shipping and discounts) Final revenue

voucherCodestring · nullableOptional

Order coupon code

userTypestring · nullableOptional

New or existing user

salesChannelstring · nullableOptional

Sales channel; web, ios and android

Responses
chevron-right
200

Success

No content

post
/api/pixel/ecomm
200

Success

No content

Last updated