?> Snowplow .NET Analytics SDK 0.1.0 released | Snowplow
Snowplow Outperforms GA4 in GigaOm Comparative Evaluation.
Read More
  1. Home
  2. Blog
  3. Releases
Releases

Snowplow .NET Analytics SDK 0.1.0 released

Jump to

Following in the footsteps of the Snowplow Scala Analytics SDK and Snowplow Python Analytics SDK, we are happy to announce the release of the Snowplow .NET Analytics SDK.

This SDK makes your Snowplow enriched events easier to work with from Azure Data Lake Analytics, Azure Functions, AWS Lambda, Microsoft Orleans and other .NET-compatible data processing frameworks.

This SDK has been developed as a first step towards our RFC, Porting Snowplow to Microsoft Azure. Over time, we expect this SDK will be used for tasks such as:

  1. Performing event data modeling in Azure Data Lake Analytics
  2. Performing analytics-on-write in Azure Functions as part of an Event Hubs-based real-time pipeline
  3. Writing real-time decisioning engines on Snowplow event streams in Microsoft Orleans:

sdk-usage-img

Read on below the jump for:

  1. Overview
  2. The JSON Event Transformer
  3. Installation
  4. Usage
  5. Getting help

1. Overview

Snowplow’s enrichment process outputs enriched events in a TSV format. This TSV currently has 131 fields, some of which are complex heterogeneous self-describing JSON, which can make it difficult to work with directly.

The Snowplow .NET Analytics SDK currently supports one transformation: the JSON Event Transformer, for turning this TSV into a more tractable JSON. Let’s check this out next.

2. The JSON Event Transformer

The JSON Event Transformer uses the exact same algorithm as that found in the Snowplow Scala Analytics SDK. Here is an excerpt from a generated JSON:

{ "app_id":"demo", "platform":"web","etl_tstamp":"2015-12-01T08:32:35.048Z", "collector_tstamp":"2015-12-01T04:00:54.000Z","dvce_tstamp":"2015-12-01T03:57:08.986Z", "event":"page_view","event_id":"f4b8dd3c-85ef-4c42-9207-11ef61b2a46e", "name_tracker":"co","v_tracker":"js-2.5.0","v_collector":"clj-1.0.0-tom-0.2.0", ... }

The most complex piece of processing is the handling of the self-describing JSONs found in the enriched event’s unstruct_event, contexts and derived_contexts fields. All self-describing JSONs found in the event are flattened into top-level plain (i.e. not self-describing) objects within the enriched event JSON.

For example, if an enriched event contained a com.snowplowanalytics.snowplow/link_click/jsonschema/1-0-1, then the final JSON would contain:

{ ... "name_tracker":"co","v_tracker":"js-2.5.0","v_collector":"clj-1.0.0-tom-0.2.0", "unstruct_event_com_snowplowanalytics_snowplow_link_click_1": { "targetUrl":"http://www.example.com", "elementClasses":["foreground"], "elementId":"exampleLink" }, ... }

3. Installation

The Snowplow .NET Analytics is published to NuGet, the .NET package manager. To add it to your project, install it in the Visual Studio Package Manager Console like so:

Install-Package Snowplow.Analytics

For more information on installation check out the .NET Analytics SDK setup guide.

4. Usage

Use the SDK like this:

using Snowplow.Analytics.Json<span class="p">; using Snowplow.Analytics.Exceptions<span class="p">; try { EventTransformer.Transform(enrichedEventTsv<span class="p">); } catch (SnowplowEventTransformationException sete) { sete.ErrorMessages.ForEach((message) => Console.WriteLine(message<span class="p">)); }

If there are any problems in the input TSV (such as unparseable JSON fields or numeric fields), the transform method will throw a SnowplowEventTransformationException. This exception contains a list of error messages – one for every problematic field in the input.

For more information, please check out the .NET Analytics SDK technical documentation.

5. Getting help

If you have any questions or run into any problems, please raise an issue or get in touch with us through the usual channels.

And if there’s another Snowplow Analytics SDK you’d like us to prioritize creating, please let us know on our Discourse!

More about
the author

Avatar
Snowplow Team
View author

Ready to start creating rich, first-party data?

Image of the Snowplow app UI