> ## Documentation Index
> Fetch the complete documentation index at: https://docs.ditto.live/llms.txt
> Use this file to discover all available pages before exploring further.

# Using the Device Dashboard

> The Portal Device Dashboard provides insights into devices that have been deployed with an application embedded with the Ditto SDK. With the Device Dashboard, you can gather and store peer-to-peer sync and network details automatically rather than needing to continuously query Ditto for this data.

The Device Dashboard is powered by the Small Peer Info (`smallPeerInfo`) Ditto system collection and available for Ditto SDK version 4.4.0 and later.

Once enabled, you can access the following details for each device using the portal:

* Mesh network connection status
* Timestamp when last seen by Ditto Server
* Names and unique identifiers
* Operating System (OS)
* Address peer key
* Latest device logs
* Custom user metadata

## Viewing devices with Ditto SDK 4.8.0 and later

The Device Dashboard will automatically be populated with  `smallPeerInfo` in the Ditto SDK 4.8.0 and later.

To opt out of having device data written and transmitted to the Portal, you must disable `smallPeerInfo`

```swift Swift theme={null}
ditto.smallPeerInfo.isEnabled = false
```

```kotlin Kotlin theme={null}
ditto.smallPeerInfo.isEnabled = false
```

```javascript JS theme={null}
ditto.smallPeerInfo.isEnabled = false
```

```java Java theme={null}
ditto.smallPeerInfo.isEnabled = false
```

```csharp C# theme={null}
ditto.SmallPeerInfo.IsEnabled = false;
```

```cpp C++ theme={null}
ditto.get_small_peer_info().set_enabled(false)
```

```rust Rust theme={null}
ditto.small_peer_info().set_enabled(false)
```

```dart Dart theme={null}
ditto.smallPeerInfo.isEnabled = false;
```

## Viewing devices with Ditto SDK 4.4.0 - 4.7.x

In earlier versions of the Ditto SDK, the `smallPeerInfo` feature needs to be manually enabled to collect data. Enable `smallPeerInfo` before calling `startSync()` using the following steps:

**Step 1**

Set `smallPeerInfo.isEnabled` to `true`:

```swift Swift theme={null}
ditto.smallPeerInfo.isEnabled = true
```

```kotlin Kotlin theme={null}
ditto.smallPeerInfo.isEnabled = true
```

```javascript JS theme={null}
ditto.smallPeerInfo.isEnabled = true
```

```java Java theme={null}
ditto.smallPeerInfo.isEnabled = true
```

```csharp C# theme={null}
ditto.SmallPeerInfo.IsEnabled = true;
```

```cpp C++ theme={null}
ditto.get_small_peer_info().set_enabled(true)
```

```rust Rust theme={null}
ditto.small_peer_info().set_enabled(true)
```

```dart Dart theme={null}
ditto.smallPeerInfo.isEnabled = true;
```

**Step 2**

Set the sync scope to BigPeer Only which indicates that the data should be synced to Ditto Server in the Cloud. Default is that the data is only captured locally.

```swift Swift theme={null}
ditto.smallPeerInfo.syncScope = .bigPeerOnly
```

```kotlin Kotlin theme={null}
ditto.smallPeerInfo.syncScope = DittoSmallPeerInfoSyncScope.BigPeerOnly
```

```javascript JS theme={null}
await ditto.smallPeerInfo.setSyncScope("BigPeerOnly")
```

```java Java theme={null}
ditto.smallPeerInfo.syncScope = DittoSmallPeerInfoSyncScope.BigPeerOnly
```

```csharp C# theme={null}
ditto.SmallPeerInfo.SyncScope  = DittoSmallPeerInfoSyncScope.BigPeerOnly
```

```cpp C++ theme={null}
ditto.get_small_peer_info().sync_scope(), SyncScope::BigPeerOnly
```

```rust Rust theme={null}
ditto.small_peer_info().set_sync_scope(DittoSmallPeerInfoSyncScope::BigPeerOnly);
```

```dart Dart theme={null}
ditto.smallPeerInfo.syncScope = SmallPeerInfoSyncScope.bigPeerOnly;
```

## Viewing devices with Ditto SDK 4.3.x and Earlier

The devices dashboard is only supported on devices with SDK version 4.4.0 and later. You must upgrade your application to a supported version of the Ditto SDK to take advantage of this feature capability.

## Custom User Defined Device Name

For cross-platform development or when targeting iOS, if you want the ability to uniquely identify devices within Ditto, call the `deviceName` property on the `ditto` namespace and specify the desired name.

> [!NOTE]
>
> This must be set before calling `ditto.sync.start()` to take effect.

```swift Swift theme={null}
ditto.deviceName = "your device name"
```

```kotlin Kotlin theme={null}
ditto.deviceName = "your device name"
```

```javascript JS theme={null}
ditto.deviceName = "your device name"
```

```java Java theme={null}
ditto.deviceName = "your device name"
```

```csharp C# theme={null}
ditto.DeviceName = "your device name";
```

```cpp C++ theme={null}
ditto.device_name = "your device name";
```

```rust Rust theme={null}
ditto.set_device_name("your device name");
```

```dart Dart theme={null}
ditto.deviceName = "your device name";
```

## Custom User Metadata

You can add custom device information into the device dashboard by setting the Small Peer Info `metadata` property on a device.

```swift Swift theme={null}
var metadata: [String: String] = [
    "app_version": "1.0.0",
    "device_id": "abc123"
]

// Set the object directly
ditto.smallPeerInfo.setMetadata(metadata)

// or

// Convert dictionary to JSON string
if let jsonData = try? JSONSerialization.data(withJSONObject: metadata, options: []),
    let jsonString = String(data: jsonData, encoding: .utf8) {

    // Set with a JSON serialized payload
    ditto.smallPeerInfo.setMetadataJSONString(jsonString)
}
```

```kotlin Kotlin theme={null}
val metadata = mutableMapOf<String, String>(
    "app_version" to "1.0.0",
    "device_id" to "abc123"
)

// Set the object directly
ditto.smallPeerInfo.metadata = metadata

// or

val jsonMetadata = JSONObject(metadata)
val jsonString = jsonMetadata.toString()

// Set with a JSON serialized payload
ditto.smallPeerInfo.metadataJsonString = jsonString
```

```javascript JS theme={null}
const metadata = {
  app_version: "1.0.0",
  device_id: "abc123"
}

// Set the object directly
ditto.smallPeerInfo.metadata = metadata

// or

const jsonString = JSON.stringify(metadata)

// Set with a JSON serialized payload
ditto.smallPeerInfo.metadataJSONString = jsonString
```

```java Java theme={null}
Map<String, String> metadata = new HashMap<>();
metadata.put("app_version", "1.0.0");
metadata.put("device_id", "abc123");

// Set the object directly
ditto.smallPeerInfo.setMetadata(metadata);

// or

JSONObject jsonMetadata = new JSONObject(metadata);
String jsonString = jsonMetadata.toString();

// Set with a JSON serialized payload
ditto.smallPeerInfo.setMetadataJsonString(jsonString);
```

```csharp C# theme={null}
Dictionary<string, string> metadata = new Dictionary<string, string>
{
    { "app_version", "1.0.0" },
    { "device_id", "abc123" }
};

// Set the object directly
ditto.SmallPeerInfo.Metadata = metadata;

// or

string jsonString = JsonConvert.SerializeObject(metadata);

// Set with a JSON serialized payload
ditto.SmallPeerInfo.MetadataJsonString = jsonString;
```

```cpp C++ theme={null}
std::map<std::string, std::string> metadata;
metadata["app_version"] = "1.0.0";
metadata["device_id"] = "abc123";

// Set the object directly
ditto.get_small_peer_info().set_metadata(metadata);

// or

nlohmann::json json_metadata(metadata);
std::string json_string = json_metadata.dump();

// Set with a json serialized payload
ditto.get_small_peer_info().set_metadata_json_string(json_string)
```

```rust Rust theme={null}
use std::collections::HashMap;
use serde_json::json;

let mut metadata = HashMap::new();
metadata.insert("app_version".to_string(), "1.0.0".to_string());
metadata.insert("device_id".to_string(), "abc123".to_string());

// Set the object directly
ditto.get_small_peer_info().set_metadata(metadata.clone());

// or

let json_metadata = json!(metadata);
let json_string = json_metadata.to_string();

// Set with a JSON serialized payload
ditto.get_small_peer_info().set_metadata_json_string(json_string);
```

```dart Dart theme={null}
final metadata = {
  "app_version": "1.0.0",
  "device_id": "abc123",
};

// Set the object directly
ditto.smallPeerInfo.metadata = metadata;

// or

final jsonString = jsonEncode(metadata);

// Set with a JSON serialized payload
ditto.smallPeerInfo.metadataJsonString = jsonString;
```


## Related topics

- [Remote Observability](https://docs.ditto.live/sdk/latest/deployment/device-observability-and-ditto-logs.md)
- [FAQs](https://docs.ditto.live/home/faq.md)
- [Device Storage Management](https://docs.ditto.live/sdk/latest/sync/device-storage-management.md)
