Orders

 

Foreword

AT Internet’s SDK allows you to tag orders placed by your users while using your application.

 

Get off to a good start

Once your tag is initialised, you can add order information to your screen hit.

If you want to use variables, be sure to import ATInternet, Tracker, Screen and Order classes in your Activity (If you wish to send cart information, please also remember to import Cart).

 

Tagging

The Screen object makes an Order method available. This method takes two parameters :

  • orderId of type String indicates order identifier
  • turnover of type double indicates order turnover

This method sends back an Order-type object.

 

Tagging examples

  1. Tagging an order and a main goal screen

    Without the SalesTracker option

    Even without the SalesTracker option enabled, you can measure the order confirmation screen (main goal) and insert the order total (turnover) as well as the order number (orderId).

    package com.atinternet.atinternetdemo;
    
    import android.app.Activity;
    import android.os.Bundle;
    
    import com.atinternet.tracker.ATInternet;
    import com.atinternet.tracker.Tracker;
    
    
    public class MainActivity extends Activity {
    
        private Tracker tracker;
    
        @Override
        protected void onCreate(Bundle savedInstanceState) {
            super.onCreate(savedInstanceState);
            setContentView(R.layout.activity_main);
            tracker = ATInternet.getInstance().getDefaultTracker();
        }
    
        @Override
        protected void onResume() {
            super.onResume();
            Screen s = tracker.Screens().add("Main goal screen");
            s.Order("4655", 3876.10);
            s.sendView();
        }
    }

    With SalesTracker option

    package com.atinternet.atinternetdemo;
    
    import android.app.Activity;
    import android.os.Bundle;
    
    import com.atinternet.tracker.ATInternet;
    import com.atinternet.tracker.Tracker;
    
    
    public class MainActivity extends Activity {
    
        private Tracker tracker;
    
        @Override
        protected void onCreate(Bundle savedInstanceState) {
            super.onCreate(savedInstanceState);
            setContentView(R.layout.activity_main);
            tracker = ATInternet.getInstance().getDefaultTracker();
        }
    
        @Override
        protected void onResume() {
            super.onResume();
            Screen s = tracker.Screens().add("Order confirmation");
            s.Order("cmd1", 94.30)
                    //Order status
                    .setStatus(1)
                    //First order from that customer
                    .setNewCustomer(true)
                    //Payment Method
                    .setPaymentMethod(1)
                    //Order Amount
                    .Amount().set(80, 94.30, 14)
                    //Order Delivery Info
                    .Delivery().set(5, 7.5, "1[TNT]")
                    // Discount info
                    .Discount().set(5, 7.5, "PROMOTION");
            s.sendView();
        }
    }
  2. Tagging an order with cart information

    For more information on tagging your cart, please visit this page: Cart (SalesTracker)

  3. Tagging an order confirmation screen on an app or external site

    The goal here is to be able to measure completed orders and reservations, despite the fact that the confirmation screen is hosted by an app or on an external site (like banking platforms, PayPal…).

    The tag must be placed on the screen preceding the user’s detour toward the banking or payment platform (the screen containing all information about the order/reservation and its content).

    package com.atinternet.atinternetdemo;
    
    import android.app.Activity;
    import android.os.Bundle;
    
    import com.atinternet.tracker.ATInternet;
    import com.atinternet.tracker.Tracker;
    
    
    public class MainActivity extends Activity {
    
        private Tracker tracker;
    
        @Override
        protected void onCreate(Bundle savedInstanceState) {
            super.onCreate(savedInstanceState);
            setContentView(R.layout.activity_main);
            tracker = ATInternet.getInstance().getDefaultTracker();
        }
    
        @Override
        protected void onResume() {
            super.onResume();
            Screen s = tracker.Screens().add("Order info before payment");
            s.Order("cmd1", 94.30)
                    //Order status
                    .setStatus(1)
                    //First order from that customer
                    .setNewCustomer(true)
                    //Payment Method
                    .setPaymentMethod(1)
                    //Order Amount
                    .Amount().set(80, 94.30, 14)
                    //Order Delivery Info
                    .Delivery().set(5, 7.5, "1[TNT]")
                    //Discount info
                    .Discount().set(5, 7.5, "PROMOTION");
            s.sendView();
        }
    }
  4. Tagging an order with the addition of custom variables
    package com.atinternet.atinternetdemo;
    
    import android.app.Activity;
    import android.os.Bundle;
    
    import com.atinternet.tracker.ATInternet;
    import com.atinternet.tracker.Tracker;
    
    
    public class MainActivity extends Activity {
    
        private Tracker tracker;
    
        @Override
        protected void onCreate(Bundle savedInstanceState) {
            super.onCreate(savedInstanceState);
            setContentView(R.layout.activity_main);
            tracker = ATInternet.getInstance().getDefaultTracker();
        }
    
        @Override
        protected void onResume() {
            super.onResume();
            Screen s = tracker.Screens().add("Order info before payment");
            s.Order("cmd1", 94.30)
                    .setNewCustomer(true)
                    .setPaymentMethod(1)
                    .setStatus(1)
                    //Order needs confirmation (bank validation)
                    .setConfirmationRequired(true)
                    .Amount().set(80, 94.30, 14)
                    .Delivery().set(4, 7.5, "4")
                    .Discount().set(5, 7.5, "SUMMER")
                    //Custom Variables
                    .CustomVars().add(1, "fr").add(2, "fr_FR");
            s.sendView();
        }
    }
 

Order class

 

Properties

NameTypeDefault valueDescription
orderIdStringEmpty stringGets or sets the order ID
turnoverDouble-1.0Gets or sets the order revenue/turnover
statusInt-1Gets or sets the order status
discountOrderDiscountnullGets or sets discount information
amountOrderAmountnullGets or sets total amount information
deliveryOrderDeliverynullGets or sets delivery information
customVariablesOrderCustomVarsnullGets or sets custom variables
isNewCustomerBooleanfalseGets or sets if the user is a new customer or not
paymentMethodInt-1Gets or sets the payment method
isConfirmationRequiredBooleanfalseGets or sets whether the order is awaiting confirmation from an external site (bank, PayPal…)
 

Classe OrderAmount

 

Properties

NameTypeDefault valueDescription
amountTaxFreeDouble-1.0Gets or sets the order total (without tax)
amountTaxIncludedDouble-1.0Gets or sets the order total (with tax)
taxAmountDouble-1.0Gets or sets the tax amount
 

Methods

NameReturn typeDescription
setOrderIncludes information about the order total
 

Classe OrderDiscount

 

Properties

NameTypeDefault valueDescription
discountTaxFreeDouble-1.0Gets or sets the discount total (without tax)
discountTaxIncludedDouble-1.0Gets or sets the discount total (with tax)
promotionalCodeStringnullGets or sets the promotional code used by the user
 

Methods

NameDefault valueDescription
setOrderIncludes information about the discount total
 

Classe OrderDelivery

 

Properties

NameTypeDefault valueDescription

shippingFeesTaxFree

Double-1.0Gets or sets the shipping total (without tax)

shippingFeesTaxIncluded

Double-1.0Gets or sets the shipping total (with tax)

deliveryMethod

StringnullGets or sets the shipping mode
 

Methods

NameReturn typeDescription
setOrderIncludes shipping information
 

Classe OrderCustomVar

 

Properties

NameTypeDefault valueDescription

varId

Int0Gets or sets the variable ID

value

StringnullGets or sets the variable value
 

Appendix

 

Identifiers for payment methods and order statuses

Below label/identifier correspondences for payment methods.
It is possible to enrich this list with your own payment methods in configuration part of your interface.

IdentifierLabelCategory
1Credit cardBank cards
2VisaBank cards
3MasterCardBank cards
4ChequeCheque
5Store credit cardsCredit cards
6FinancingCredit cards
7Wire transferBank transfer
8Direct debitDirect debit
9PayPalElectronic money

Below label/identifier correspondences for order statuses.

IdentifierLabel
0No information
1Pending
2Cancelled
3Approved
4Returned
Last update: 04/03/2020