Leira.TrackZero.NetCore 1.2.0

The ID prefix of this package has been reserved for one of the owners of this package by NuGet.org. Prefix Reserved
There is a newer version of this package available.
See the version list below for details.
dotnet add package Leira.TrackZero.NetCore --version 1.2.0
NuGet\Install-Package Leira.TrackZero.NetCore -Version 1.2.0
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="Leira.TrackZero.NetCore" Version="1.2.0" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add Leira.TrackZero.NetCore --version 1.2.0
#r "nuget: Leira.TrackZero.NetCore, 1.2.0"
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
// Install Leira.TrackZero.NetCore as a Cake Addin
#addin nuget:?package=Leira.TrackZero.NetCore&version=1.2.0

// Install Leira.TrackZero.NetCore as a Cake Tool
#tool nuget:?package=Leira.TrackZero.NetCore&version=1.2.0

# #

TrackZero

Powerful, insightful and real-time analytics that helps you take your products and apps to the next level. For more details, please visit https://TrackZero.io

Installation

Install-Package Leira.TrackZero.NetCore

Setup (Dependency Injection)

API Project

In startup.cs add the following

services.AddTrackZero("apiKey");

Modify your controller

public class MainController : Controller
{
  private readonly TrackZeroClient trackZeroClient;

  public MainController(TrackZeroClient trackZeroClient)
  {
    this.trackZeroClient = trackZeroClient;
  }
}

Console Apps, Windows Forms....etc

var serviceProvider =
    new ServiceCollection()
    // This adds TrackZero as a Singleton to Dependency Injection. Make sure to add your API Key
    .AddTrackZero("e227989c-3ff5-4a5a-aaff-1fb18e0ad599.FqQInMoGACcfZJ3DmqLjTfvrYBIuFlNM")
    .BuildServiceProvider();
    
// You can get the trackZero instance by requesting it from the service provider, or by adding the TrackZeroClient to the constructor class.
var trackZeroClient = serviceProvider.GetRequiredService<TrackZeroClient>();

Usage

Sending Entities

// Prepare your entity (User object), if we already have an entity of Type "User" and Id 1, this will update the information stored in TrackZero with the ones we set here.
Entity user = new Entity("user", 1)
// Adding attributes (Properties) to send to TrackZero and make it reportable.
.AddAttribute("Name", "Jane Doe")
.AddAttribute("Birthdate", new DateTime(1988, 11, 7))
// Adding Reference Attributes that will link to other entities.
// Since the Entity of Type "Country" and Id "US" doesn't exist in our project, it will be created automatically. We will add more attributes to it later.
.AddEntityReferencedAttribute("Home Country", "Country", "US");

// Send the Entity to TrackZero
await trackZeroClient.UpsertEntityAsync(user)
// If the context/scheduler do not matter to your application flow, use ConfigureAwait(false) as it aids performance.
// For more details on ConfigureAwait, check this great blog post https://devblogs.microsoft.com/dotnet/configureawait-faq/
.ConfigureAwait(false);

Sending Events

// Prepare the event. Every event has a minimum requirement of Name (Event Name), and Emitter info (The entitiy that triggered the event).
Event myEvent = new Event("User", 1, "Subscribed")
{
  StartTime = DateTime.UtcNow, //(Optional) If you don't specify StartTime, it will be automatically set to the current time UTC
  EndTime = DateTime.UtcNow, //(Optional) If you don't specify EndTime, it will be automatically set to the current time UTC
  Id = Guid.NewGuid(), // (Optional) Specifying your own Id prevents duplication if it happens and you send this event again. When not specified, it will be automatically set to a NewGuid.
}
// Just like entities, You can add attributes (Properties) to send to TrackZero and make it reportable.
.AddAttribute("Paid Amount", 9.99)
// Adding Reference Attributes that will link to other entities.
// Since the Entity of Type "Country" and Id "US" doesn't exist in our project, it will be created automatically. We will add more attributes to it later.
.AddEntityReferencedAttribute("User Source", "Marketing Campaign", "Appstore Direct Marketing");

// Send the Event to TrackZero
await trackZeroClient.TrackEventAsync(myEvent)
// If the context/scheduler do not matter to your application flow, use ConfigureAwait(false) as it aids performance.
// For more details on ConfigureAwait, check this great blog post https://devblogs.microsoft.com/dotnet/configureawait-faq/
.ConfigureAwait(false);

Deleting Events

// Deleting an event
await trackZeroClient.DeleteEventAsync("Subscribed", 1).ConfigureAwait(false);

⚠️ Deletion is immediate and permanent and cannot be undone

Deleting Entities

// Deleting an event
await trackZeroClient.DeleteEventAsync("Subscribed", 1).ConfigureAwait(false);

⚠️ Deleting an Entity WILL DELETE ALL EVENTS Emitted by this entity. Be very careful here!

⚠️ Deletion is immediate and permanent and cannot be undone

Product Compatible and additional computed target framework versions.
.NET net5.0 was computed.  net5.0-windows was computed.  net6.0 was computed.  net6.0-android was computed.  net6.0-ios was computed.  net6.0-maccatalyst was computed.  net6.0-macos was computed.  net6.0-tvos was computed.  net6.0-windows was computed.  net7.0 was computed.  net7.0-android was computed.  net7.0-ios was computed.  net7.0-maccatalyst was computed.  net7.0-macos was computed.  net7.0-tvos was computed.  net7.0-windows was computed.  net8.0 was computed.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed. 
.NET Core netcoreapp3.1 is compatible. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last updated
2.3.0 435 4/25/2022
2.2.2 437 1/17/2022
2.2.1 410 1/11/2022
2.2.0 248 12/17/2021
2.1.0 268 11/15/2021
1.4.0 318 9/27/2021
1.3.0 311 9/4/2021
1.2.1 295 8/23/2021
1.2.0 387 8/21/2021

Initial