To initialize the API you need th request the following from support@netminers.net:

  • The latest Netminers Backend-Backend tracking API
  • Your Account id from Netminers

The following example demonstrates the basic usage.

 

// Call ONCE
public static void InitTracking()
{
   NMAsynchronousTracker.SubDomain = "toysinc";
   NMAsynchronousTracker.AccountId = "toysinc";
}
 
public static void TrackPurchase()
{
   // IMPORTANT!!!
   // Netminers binding ids
   string userId = "";
   string sessionId = "";
 
   // Setup necessary commerce parameters
   string url = "https://www.toysinc.com/Checkout/Basket.aspx";
   string nameAndCategory = "Games/Nintendo/Wii U/Mario Kart 8";
   string sku = "3842";
   double price = 59.95;
   int quantity = 1;
 
   // Arbitrary data used for later data integration, one-to-one markering etc.
   Dictionary<string, string> additionalVariables = new Dictionary<string, string>() { 
      {"customer_id", "mario@nintendo.org"},    // Your internal customer identification for futher data integration
      {"redeem", "1"}                           // Did the user redeem a coupon?
   };
 
   // Construct commerce event object
   NMAsynchronousTracker.NMAddItemCommerceEvent commerceEvent = new NMAsynchronousTracker.NMAddItemCommerceEvent(
      url,
      nameAndCategory,
      sku,
      price,
      quantity,
      additionalVariables,
      userId,
      sessionId,
      new NMAsynchronousTracker.NMTrackingEvent.LoggingCallback(LogTrackingResult)
   );
   NMAsynchronousTracker.Enqueue(commerceEvent);
}
 
public static void LogTrackingResult(string message, NMAsynchronousTracker.NMTrackingEvent.LoggingLevel level)
{
   // LOG TO YOUR MONITORED LOGGING BACKEND
}