Product events

 

Foreword

This tagging documentation only applies to Tracker from version 2.16.0.

If you can 't see the “Sales Insights” menu entry in Explorer, please get in touch with us so we can activate this for you.

 

Product events

With the tracker, an ECommerce object is available, exposing different objects and methods useful for measuring:

  • Product displays
  • Product page displays
  • Add-to-cart or remove-from-cart actions
 

Product display

Measuring product display is done by creating a DisplayProduct object, to which the following is associated:

  • A list of products, Products, which can contain one or several ECommerceProduct-type products.

A product 's properties should be declared as a HashMap-type collection, with different keys:

  • “id” – String: Product ID (mandatory).
  • “variant” – String: Product variant (size, colour, etc.).
  • “article” – String: Additional level of detail for product variant.
  • “placement” – String: Product placement.
  • “promocode” – Array: Promotional code table including one or several codes. A promotional code is declared as a label.
  • “$” – String: Product name.
  • “brand” – String: Product brand.
  • “discount” – Boolean: Discounted product.
  • “pricetaxincluded” – Float: Price, including tax.
  • “pricetaxfree” – Float: Price, excluding tax.
  • “stock” – Boolean: Product in stock.
  • “category1” – String: The product 's level 1 category (up to 6 tree structure levels are possible; from “category1” to “category6”).

Example

Tracker tracker = ATInternet.getInstance().getDefaultTracker();
DisplayProduct dp = tracker.ECommerce().DisplayProducts().add();
dp.Products().add(new ECommerceProduct(new HashMap<String, Object>() {{
    put("id", "7");
    put("variant", "1");
    put("article", "21");
    put("placement", "homepage");
    put("promocode", new ArrayList() {{
                            add("AQQYRTGJ");
                        }});
    put("$", "laptop_A56");
    put("brand", "ACER");
    put("discount", true);
    put("pricetaxincluded", 549);
    put("pricetaxfree", 456.2);
    put("stock", true);
    put("category1", "Computers_and_Networking");
    put("category2", "Computers");
    put("category3", "Laptops");
}}));
tracker.dispatch();

You may use the independent method “tracker.Events.send()” in order to send only your Ecommerce data.

 

Product page display

Measuring the display of a product page is done by creating a DisplayPageProduct object, to which the following is associated:

  • an ECommerceProduct-type product.

A product 's properties should be declared as a HashMap-type collection, with different keys:

  • “id” – String: Product ID (mandatory).
  • “variant” – String: Product variant (size, colour, etc.).
  • “article” – String: Additional level of detail for product variant.
  • “placement” – String: Product placement.
  • “promocode” – Array: Promotional code table including one or several codes. A promotional code is declared as a label.
  • “$” – String: Product name.
  • “brand” – String: Product brand.
  • “discount” – Boolean: Discounted product.
  • “pricetaxincluded” – Float: Price, including tax.
  • “pricetaxfree” – Float: Price, excluding tax.
  • “stock” – Boolean: Product in stock.
  • “category1” – String: The product 's level 1 category (up to 6 tree structure levels are possible; from “category1” to “category6”).

Example

Tracker tracker = ATInternet.getInstance().getDefaultTracker();
tracker.ECommerce().DisplayPageProducts().add();
dpp.Product().setAll(new HashMap<String, Object>() {{
    put("id", "7");
    put("variant", "1");
    put("article", "21");
    put("placement", "homepage");
    put("promocode", new ArrayList() {{
                            add("AQQYRTGJ");
                        }});
    put("$", "laptop_A56");
    put("brand", "ACER");
    put("discount", true);
    put("pricetaxincluded", 549);
    put("pricetaxfree", 456.2);
    put("stock", true);
    put("category1", "Computers_and_Networking");
    put("category2", "Computers");
    put("category3", "Laptops");
}});
tracker.dispatch();

You may use the independent method “tracker.Events.send()” in order to send only your Ecommerce data.

 

Product addition

Measuring the addition of a product to the cart is done by creating an AddProduct object, to which the following are associated:

  • an ECommerceCart-type cart
  • an ECommerceProduct-type product

A cart must contain a property:

  • “id” – String: Cart ID (mandatory).

A product 's properties should be declared as a HashMap-type collection, with different keys:

  • “id” – String: Product ID (mandatory).
  • “variant” – String: Product variant (size, colour, etc.).
  • “article” – String: Additional level of detail for product variant.
  • “placement” – String: Product placement.
  • “promocode” – Array: Promotional code table including one or several codes. A promotional code is declared as a label.
  • “$” – String: Product name.
  • “brand” – String: Product brand.
  • “discount” – Boolean: Discounted product.
  • “pricetaxincluded” – Float: Price, including tax.
  • “pricetaxfree” – Float: Price, excluding tax.
  • “stock” – Boolean: Product in stock.
  • “quantity” – Number: Number of products to add.
  • “category1” – String: The product 's level 1 category (up to 6 tree structure levels are possible; from “category1” to “category6”).
  • “cartcreation” – Boolean: Cart creation (true if the action of adding a product has resulted in cart creation, false otherwise).

Example

Tracker tracker = ATInternet.getInstance().getDefaultTracker();
AddProduct ap = tracker.ECommerce().AddProducts().add();
ap.Cart().set("id", "34");
ap.Product().setAll(new HashMap<String, Object>() {{ 
    put("id", "3"); 
    put("variant", "1");
    put("article", "21");
    put("placement", "homepage");
    put("promocode", new ArrayList() {{
                            add("AQQYRTGJ");
                        }});
    put("$", "laptop_A56"); 
    put("brand", "ACER"); 
    put("discount", true); 
    put("pricetaxincluded", 549); 
    put("pricetaxfree", 456.2);
    put("stock", true);
    put("quantity", 1);
    put("cartcreation", true);
    put("category1", "Computers_and_Networking"); 
    put("category2", "Computers"); 
    put("category3", "Laptops");
}});
tracker.dispatch();

You may use the independent method “tracker.Events.send()” in order to send only your Ecommerce data.

 

Product deletion

Measuring the deletion of a product from the cart is done by creating a RemoveProduct object, to which the following are associated:

  • an ECommerceCart-type cart
  • an ECommerceProduct-type product

A cart must contain a property:

  • “id” – String: Cart ID (mandatory).

A product 's properties should be declared as a HashMap-type collection, with different keys:

  • “id” – String: Product ID (mandatory).
  • “variant” – String: Product variant (size, colour, etc.).
  • “article” – String: Additional level of detail for product variant.
  • “placement” – String: Product placement.
  • “promocode” – Array: Promotional code table including one or several codes. A promotional code is declared as a label.
  • “$” – String: Product name.
  • “brand” – String: Product brand.
  • “discount” – Boolean: Discounted product.
  • “pricetaxincluded” – Float: Price, including tax.
  • “pricetaxfree” – Float: Price, excluding tax.
  • “stock” – Boolean: Product in stock.
  • “quantity” – Number: Number of products to add.
  • “category1” – String: The product 's level 1 category (up to 6 tree structure levels are possible; from “category1” to “category6”).

Example

Tracker tracker = ATInternet.getInstance().getDefaultTracker();
RemoveProduct rp = tracker.ECommerce().RemoveProducts().add();
rp.Cart().set("id", "34");
rp.Product().setAll(new HashMap<String, Object>() {{ 
    put("id", "3"); 
    put("variant", "1");
    put("article", "21");
    put("placement", "homepage");
    put("promocode", new ArrayList() {{
                            add("AQQYRTGJ");
                        }});
    put("$", "laptop_A56"); 
    put("brand", "ACER"); 
    put("discount", true); 
    put("pricetaxincluded", 549); 
    put("pricetaxfree", 456.2);
    put("stock", true);
    put("quantity", 1);
    put("category1", "Computers_and_Networking"); 
    put("category2", "Computers"); 
    put("category3", "Laptops");
}});
tracker.dispatch();

You may use the independent method “tracker.Events.send()” in order to send only your Ecommerce data.

Last update: 12/08/2020