Developers » Windows » Ecommerce » Produits
Produits
Avant-propos
Le SDK AT Internet vous permet de marquer les produits proposés à la vente, vus par vos utilisateurs durant l’utilisation de votre application.
La mesure des produits vus nécessite l’activation d’une option. Veuillez contacter le centre support pour plus d’informations.
Pour bien débuter
Une fois votre marqueur initialisé, vous pouvez envoyer les informations de produits vus.
Pour utiliser les classes et les méthodes du SDK, veillez à ajouter le namespace ATInternet dans votre Page.
Marquage
Le tracker met à disposition une propriété Products. Cette propriété expose les méthodes suivantes :
- Add : Ajoute un produit vu à la liste et retourne un objet Product
- Remove : Supprime un produit vu de la liste
- RemoveAll : Supprime tous les produits vus
- SendViews : Envoie les informations sur les produits vus
Exemples de marquage
- Marquage d’un produit vu
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]"); } } }
- Marquage de plusieurs produits vus
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(); } } }
- Marquage de produits vus avec ajout d’un produit au panier
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(); } } }
- Suppression d’un produit
private void RemoveProduct() { tracker.Products.Remove("1254[MF839FA]") }
- Suppression de tous les produits
private void RemoveAllProducts() { tracker.Products.RemoveAll() }
Classe Product
Propriétés
Nom | Type | Valeur par défaut | Description |
---|---|---|---|
ProductId | String | Chaîne vide | Obtient ou définit l’identifiant du produit |
Category1 | String? | nil | Obtient ou définit la 1ère catégorie du produit |
Category2 | String? | nil | Obtient ou définit la 2nde catégorie du produit |
Category3 | String? | nil | Obtient ou définit la 3ème catégorie du produit |
Category4 | String? | nil | Obtient ou définit la 4ème catégorie du produit |
Category5 | String? | nil | Obtient ou définit la 5ème catégorie du produit |
Category6 | String? | nil | Obtient ou définit la 6ème catégorie du produit |
Quantity | Int? | nil | Obtient ou définit la quantité de produit |
UnitPriceTaxIncluded | Double? | nil | Obtient ou définit le prix unitaire TTC |
UnitPriceTaxFree | Double? | nil | Obtient ou définit le prix unitaire HT |
DiscountTaxIncluded | Double? | nil | Obtient ou définit le montant de remise TTC |
DiscountTaxFree | Double? | nil | Obtient ou définit le montant de remise HT |
PromotionalCode | String? | nil | Obtient ou définit le code promotionnel pour le produit |