Kolky / Allium

Google Measurement Protocol in C# for tracking Apps
Microsoft Public License
1 stars 0 forks source link

Few More Examples #8

Open YodasMyDad opened 6 years ago

YodasMyDad commented 6 years ago

Could you add a few more examples of how to use your project, especially the ecommerce tracking stuff. Just added to the readme would be great.

Kolky commented 6 years ago

I personally use it to track timing of certain tasks in desktop-applications, for example:

using (var timer = analytics.TrackTimerHit("LongRunningTask", "TaskParametersAsString"))
{
   // Do stuff
}

Tracking e-commerce is not much different;

var hit= analyticsSession.TrackTransactionHit("TransactionId");
hit.Parameters.TransactionRevenue= "Revenue"
hit.Parameters.TransactionShipping= "ShippingCosts"
hit.Parameters.App.ApplicationName = "AppName";
hit.Parameters.App.ApplicationId = "com.company.app";
hit.Parameters.App.ApplicationVersion = executingAssembly.GetAssemblyGitVersion().ToString();
hit.Send();