Cart

 

Foreword

AT Internet’s SDK allows you to tag your application’s basket or cart, as well as its contents.

As with a real cart, you can add or remove products from the cart and send this information in your screen hit.

 

Get off to a good start

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

If you want to use variables, be sure to import ATInternet, Tracker, Screen and Cart classes in your Activity.

 

Tagging

The tracker makes a cart object available. This property exposes the following methods:

  • set: Allows you to define a cart ID to then be able to add products

    So that cart information is successfully taken into account, the ID must be greater than zero

  • unset: Allows you to remove products from the cart and to reset the cart’s ID

The cart object also exposes a products object allowing you to add or remove products to/from the cart.

The products object exposes the following methods:

  • add: Adds a product to the cart and returns a Product object
  • remove: Deletes a product from the cart
  • removeAll: Removes all products contained in the cart

To send cart information without sending order information, you must link your cart with your screen using setCart Screen object methodIf not, cart information will not be added to your screen hit.

 

Tagging examples

  1. Tagging a screen summarising the content of a cart with 2 articles

    The cart ID must be identical to the ID present in the order content tag; if not, the cart will be considered as abandoned. Please also remember, the ID used for the cart must be unique and should never be reused, in order to avoid inconsistencies in your analyses.

  2. Tagging an order with cart information

    For more information on tagging your orders, visit this page: Orders (SalesTracker)

  3. Resetting a cart after having completed an order
  4. Replacing an existing cart
  5. Adding products to the cart
  6. Removing a product from the cart
  7. Removing all products in the cart
 

Cart class

 

Properties

Name Type Default value Description
cartId String “” Gets or sets the cart ID
products Products null Gets or sets the cart products
 

Methods

Name Return type Description
set Cart Activates the cart and defines an ID
unset void Resets the cart and removes the products
 

Product class

 

Properties

Name Type Default value Description
productId String null Gets or sets the product ID
category1 String null Gets or sets the first product category
category2 String null Gets or sets the second product category
category3 String null Gets or sets the third product category
category4 String null Gets or sets the fourth product category
category5 String null Gets or sets the fifth product category
category6 String null Gets or sets the sixth product category
quantity Int -1 Gets or sets the product quantity
unitPriceTaxIncluded Double -1 Gets or sets the price per unit (including tax)
unitPriceTaxFree Double -1 Gets or sets the price per unit (without tax)
discountTaxIncluded Double -1 Gets or sets the discount amount (including tax)
discountTaxFree Double -1 Gets or sets the discount amount (without tax)
promotionalCode String null Gets or sets the product’s promotional code
Was this post helpful?
Yes
No
Last update: 05/04/2018