# Windows

{% tabs %}
{% tab title="Universal Windows Platform (UWP)" %}

## 1. NuGet Installation

### Package Manager UI

Find the **`DevToDev.Analytics.Uwp`** package using the package manager search engine and click Install. The latest version of the package is recommended.

### Package Manager Console

## 2. SDK Initialization

Initialize the library using the following code:

```csharp
var config = new DTDAnalyticsConfiguration();
config.LogLevel = DTDLogLevel.Error;
DTDAnalytics.Initialize("App ID", config);
```

* You can find the **App ID** in the settings of the respective app in devtodev (Settings → SDK → Integration → Credentials).
* **`config`** - is a **`DTDAnalyticsConfiguration`** object instance that is used for specifying additional properties during initialization.

**`DTDAnalyticsConfiguration`**

| **Parameter**              | **Type**                 | **Description**                                                                                                                                                                                                                                                                                                           |
| -------------------------- | ------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| **`currentLevel`**         | Integer                  | The player level at the moment of devtodev SDK initialization. It’s optional but we recommend using it for improving data accuracy.                                                                                                                                                                                       |
| **`userId`**               | String                   | A custom user ID assigned by the developer. In the case of default calculation by device IDs, the identifier can be used for searching users in devtodev. In case the project uses calculation by user IDs, the parameter is mandatory because it becomes the principal calculation ID in devtodev.                       |
| **`trackingAvailability`** | DTDTrackingStatus (enum) | The property allows or disallows devtodev tracking of the user. By default, it is set to **`DTDTrackingStatus.Enable`**. SDK stores the previously assigned value. Pass **`DTDTrackingStatus.Disable`** if the user opted out of tracking in line with GDPR.                                                              |
| **`logLevel`**             | DTDLogLevel (enum)       | The level of logging the SDK activity. The **`DTDLogLevel.No`** value is used by default. For troubleshooting during integration, it is recommended to set it to **`DTDLogLevel.Debug`**, and either switch it off **`DTDLogLevel.No`** or use it only for error handling **`DTDLogLevel.Error`** in the release version. |

Example:

```csharp
var config = new DevToDev.Analytics.DTDAnalyticsConfiguration();
config.LogLevel = DTDLogLevel.Error;
config.CurrentLevel = 2;
config.UserId = "CustomUserId";
config.TrackingAvailability = DTDTrackingStatus.Enable;
DevToDev.Analytics.DTDAnalytics.Initialize("App ID", config);
```

{% endtab %}

{% tab title=".NET Native" %}

## 1. NuGet Installation

### Package Manager UI

Find the **`DevToDev.Analytics`** package using the package manager search engine and click Install. The latest version of the package is recommended.

### Package Manager Console

## 2. SDK Initialization

Initialize the library using the following code:

```csharp
var config = new DTDAnalyticsConfiguration();
config.LogLevel = DTDLogLevel.Error;
DTDAnalytics.Initialize("App ID", config);
```

* You can find the App ID in the settings of the respective app in devtodev (Settings → SDK → Integration → Credentials).
* **`config`** - is a **`DTDAnalyticsConfiguration`** object instance that is used for specifying additional properties during initialization.

**`DTDAnalyticsConfiguration`**

| **Parameter**              | **Type**                 | **Description**                                                                                                                                                                                                                                                                                                                   |
| -------------------------- | ------------------------ | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| **`currentLevel`**         | Integer                  | The player level at the moment of devtodev SDK initialization. It’s optional but we recommend using it for improving data accuracy.                                                                                                                                                                                               |
| **`userId`**               | String                   | A custom user ID assigned by the developer. In the case of default calculation by device IDs, the identifier can be used for searching users in devtodev. In case the project uses calculation by user IDs, the parameter is mandatory because it becomes the principal calculation ID in devtodev.                               |
| **`trackingAvailability`** | DTDTrackingStatus (enum) | The property allows or disallows devtodev tracking of the user. By default, it is set to ***`DTDTrackingStatus.Enabl`*****`e`**. SDK stores the previously assigned value. Pass ***`DTDTrackingStatus.Disable`*** if the user opted out of tracking in line with GDPR.                                                            |
| **`logLevel`**             | DTDLogLevel (enum)       | The level of logging the SDK activity. The ***`DTDLogLevel.No`*** value is used by default. For troubleshooting during integration, it is recommended to set it to ***`DTDLogLevel.Debug`***, and either switch it off ***`DTDLogLevel.No`*** or use it only for error handling ***`DTDLogLevel.Error`*** in the release version. |
| **`ApplicationVersion`**   | String                   | The app version during the devtodev SDK initialization. It is recommended that you set the app version before the initialization to make the collection of app version statistics more precise.                                                                                                                                   |

Example:

```csharp
var config = new DevToDev.Analytics.DTDAnalyticsConfiguration();
config.LogLevel = DTDLogLevel.Error;
config.CurrentLevel = 2;
config.UserId = "CustomUserId";
config.TrackingAvailability = DTDTrackingStatus.Enable;
config.ApplicationVersion = "1.2.34";
DevToDev.Analytics.DTDAnalytics.Initialize("App ID", config);
```

## **3. SDK Activity**

The SDK can’t control app activity hence this responsibility is passed on to the developer. During the SDK initialization, the activity is triggered automatically, and later the activity status will not change automatically. For tracking app activity, the developer can use the **`DTDAnalytics.StartActivity`** and **`DTDAnalytics.StopActivity`** methods. It is recommended that you use the **`DTDAnalytics.StopActivity`** method to stop the activity when the app goes into the background or being closed. If the window is re-opened from the taskbar it is recommended to renew the activity by using the **`DTDAnalytics.StartActivity`** method.<br>
{% endtab %}
{% endtabs %}

1
