AmplitudeSharp 1.0.5

There is a newer version of this package available.
See the version list below for details.
dotnet add package AmplitudeSharp --version 1.0.5                
NuGet\Install-Package AmplitudeSharp -Version 1.0.5                
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="AmplitudeSharp" Version="1.0.5" />                
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add AmplitudeSharp --version 1.0.5                
#r "nuget: AmplitudeSharp, 1.0.5"                
#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 AmplitudeSharp as a Cake Addin
#addin nuget:?package=AmplitudeSharp&version=1.0.5

// Install AmplitudeSharp as a Cake Tool
#tool nuget:?package=AmplitudeSharp&version=1.0.5                

AmplitudeSharp

A simple to use Amplitude analytics logging library for C#

Build status

NOTE: this library is early development stages, many changes are planned (including better documentation) use at your own risk

Features

  • Simple setup
  • Native Amplitude API (instead of going through some other service, such as segment.io)
  • Automatic identification of hardware
  • Support for offline scenarios (events are queued and stored offline to be sent later)

Setup

  1. If you don't have an Amplitude account already, head over to Amplitude and create an account.
  2. Once created, note your project API key, you can find this information in Settings > Projects section, note each project will have a different API key. I also recommend that you have dev and prod environments/projects.
  3. Install the nuget package
  4. Initialize the library on app start and uninitialize the library when the app quits (here is a WPF app example):
using AmplitudeSharp;

public partial class App : Application
{
    private AmplitudeService analytics;

    protected override void OnStartup(StartupEventArgs e)
    {
        // Only call this once per lifetime of the object
        analytics = AmplitudeService.Initialize("<YOUR API KEY>");

        base.OnStartup(e);
    }

    protected override void OnExit(ExitEventArgs e)
    {
        base.OnExit(e);

        // Terminate the analytics upload thread
        analytics.Dispose();
    }
}
  1. Identify your user:
// Setup our user properties:
UserProperties userProps = new UserProperties();
userProps.UserId = "testuser_2";
userProps.ExtraProperties.Add("email", "test2@example.com");
// Note that userProps.AppVersion is automatically inferred from the
// version of the calling assembly, but can be overriden here, e.g:
// userProps.AppVersion = Assembly.GetExecutingAssembly().GetName().Version.ToString();

// Setup our device properties:
DeviceProperties devProps = new DeviceProperties();
// It's a good idea to set a device ID, that way you can tell how many devices
// a give user uses. Best way is to generate a device ID on first start and stash it
// in the settings of the app
devProps.DeviceId = "<SOME PERSISTED GUID>";
AmplitudeService.Instance.Identify(userProps, devProps);
  1. Track events
    There are two types of events you can track: with and without parameters. Events without parameters require only a name to be logged, like so:
    AmplitudeService.Instance.Track("simple_event");
    Events with parameters can be logged as follows:
    AmplitudeService.Instance.Track("event_with_properties", new { count = 4, category = "some value" });

  2. Session management
    A session is automatically created when the library is initialized, however you may want to create a new session without restarting the app. Let's say you want to create a new session when a user opens a new project/file/etc in your application, to do that, simple call:
    AmplitudeService.Instance.NewSession();
    This will allow you track session length on Amplitude and measure engagement of your users over time

Product Compatible and additional computed target framework versions.
.NET Framework net461 is compatible.  net462 was computed.  net463 was computed.  net47 was computed.  net471 was computed.  net472 was computed.  net48 was computed.  net481 was computed. 
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
1.0.22 20,233 7/24/2018
1.0.21 6,089 6/14/2018
1.0.20 1,160 6/14/2018
1.0.15 1,030 6/13/2018
1.0.14 1,199 5/1/2018
1.0.13 1,056 4/18/2018
1.0.12 1,074 4/18/2018
1.0.11 1,094 4/11/2018
1.0.10 1,073 4/10/2018
1.0.9 1,043 4/10/2018
1.0.8 1,106 4/3/2018
1.0.7 1,064 3/29/2018
1.0.6 1,078 3/29/2018
1.0.5 1,139 3/28/2018
1.0.4 1,097 3/28/2018
1.0.3 1,073 3/28/2018

Initial release.