Developers » Windows » Ecommerce » Products
Products
Foreword
AT Internet’s SDK enables you to tag products for sale that are viewed by your users during usage of your application.
The measurement of viewed products needs an option to be activated. Please contact the support centre for more information.
Get off to a good start
Once your tag has been initialised, you can send information of viewed products.
To use SDK class and methods, add ATInternet namespace to your Page.
Tagging
The tracker makes a Products property available. This property exposes the following methods :
- Add : Add a viewed product to the list and returns a Product object.
- Remove : Removes a viewed product in the list.
- RemoveAll : Removes all viewed products.
- SendViews : Send all viewed products.
Tagging examples
- Tagging a viewed product
using System; using System.Collections.Generic; using Windows.Data.Json; using Windows.UI.Xaml; using Windows.UI.Xaml.Controls; using ATInternet; using Windows.UI.Xaml.Navigation; namespace App1 { public sealed partial class MainPage : Page { Tracker tracker; public MainPage() { this.InitializeComponent(); tracker = SmartTag.Instance.defaultTracker; } protected override void OnNavigatedTo(NavigationEventArgs e) { tracker.Products.Add("1253[MF885FA]", "1[Desktop]", "10[iMac]"); } } }
- Tagging several viewed products
using System; using System.Collections.Generic; using Windows.Data.Json; using Windows.UI.Xaml; using Windows.UI.Xaml.Controls; using ATInternet; using Windows.UI.Xaml.Navigation; namespace App1 { public sealed partial class MainPage : Page { Tracker tracker; public MainPage() { this.InitializeComponent(); tracker = SmartTag.Instance.defaultTracker; } protected override void OnNavigatedTo(NavigationEventArgs e) { tracker.Products.Add("1253[MF885FA]", "1[Laptop]" , "10[Macbook Pro]" ); tracker.Products.Add("1253[MF889FA]", "1[Desktop]", "10[iMac]"); tracker.Products.SendViews(); } } }
- Tagging viewed products with an add to cart
using System; using System.Collections.Generic; using Windows.Data.Json; using Windows.UI.Xaml; using Windows.UI.Xaml.Controls; using ATInternet; using Windows.UI.Xaml.Navigation; namespace App1 { public sealed partial class MainPage : Page { Tracker tracker; public MainPage() { this.InitializeComponent(); tracker = SmartTag.Instance.defaultTracker; List products = new List(); tracker.Cart.Set("1"); Product p1 = tracker.Cart.Products.Add("1253[MF885FA]", "1[Desktop]", "10[iMac]"); p1.Category1 = "10Shoes"; p1.Quantity = 1; p1.UnitPriceTaxFree = 70; p1.UnitPriceTaxIncluded = 85; p1.PromotionalCode = "ATCode"; p1.DiscountTaxFree = 0; p1.DiscountTaxIncluded = 0; products.Add(p1); Product p2 = tracker.Cart.Products.Add("ID[P2]"); p2.Category1 = "20Socks"; p2.Quantity = 2; p2.UnitPriceTaxFree = 7; p2.UnitPriceTaxIncluded = 10; products.Add(p2); } protected override void OnNavigatingFrom(NavigationEventArgs e) { // Go to cart resume and send a screen hit with cart content Screen cartScreen = tracker.Screens.Add("Cart resume"); // If isBasketScreen is not set to true, Cart info won't be added to Screen hit cartScreen.IsBasketScreen = true; cartScreen.SendView(); } protected override void OnNavigatedTo(NavigationEventArgs e) { tracker.Products.SendViews(); tracker.Screens.Add("store").SendView(); } } }
- Removal of a product
private void removeProduct() { tracker.Products.Remove("1254[MF839FA]") }
- Removal of all products
private void removeAllProducts() { tracker.Products.RemoveAll() }
Product class
Properties
Name | Type | Default value | Description |
---|---|---|---|
ProductId | String | Empty string | Gets or sets the product ID |
Category1 | String? | nil | Gets or sets the products 1st category |
Category2 | String? | nil | Gets or sets the products 2nd category |
Category3 | String? | nil | Gets or sets the products 3rd category |
Category4 | String? | nil | Gets or sets the products 4th category |
Category5 | String? | nil | Gets or sets the products 5th category |
Category6 | String? | nil | Gets or sets the products 6th category |
Quantity | Int? | nil | Gets or sets the product quantity |
UnitPriceTaxIncluded | Double? | nil | Gets or sets the unit price, including tax |
UnitPriceTaxFree | Double? | nil | Gets or sets the unit price, excluding tax |
DiscountTaxIncluded | Double? | nil | Gets or sets the total discount, including tax |
DiscountTaxFree | Double? | nil | Gets or sets the total discount, excluding tax |
PromotionalCode | String? | nil | Gets or sets the products promotional code |