An open API service indexing awesome lists of open source software.

https://github.com/cedrainteractive/teliqos-sdk-cpp

Official C++ SDK for Teliqos game analytics. Lightweight, open source, thread-safe.
https://github.com/cedrainteractive/teliqos-sdk-cpp

analytics-sdk cmake cpp cpp17 cross-platform event-tracking game-analytics game-development offline-first player-analytics raylib sdk telemetry thread-safe unreal-engine

Last synced: 4 days ago
JSON representation

Official C++ SDK for Teliqos game analytics. Lightweight, open source, thread-safe.

Awesome Lists containing this project

README

          


Teliqos C++ SDK


Official C++ SDK for Teliqos game analytics.

Lightweight, open source, thread-safe. Works with raylib, Unreal Engine, and any C++ project.


CI
License
Platform
C++17

---

## Features

- Automatic session tracking and heartbeat
- Event batching with configurable intervals
- SQLite offline queue for unreliable networks
- Jittered exponential backoff on failures
- Platform-specific device info collection (Windows, macOS, Linux)
- GDPR opt-out with a single call
- Thread-safe, non-blocking design

## Quick Start

```cpp
#include "teliqos/teliqos.h"

int main() {
Teliqos::Config config;
config.apiKey = "mq_live_your_key_here";
config.appVersion = "1.0.0";
Teliqos::init(config);

Teliqos::identify("player_42");

Teliqos::EventData event;
event.nums["score"] = 1500.0;
event.strs["level"] = "3-1";
Teliqos::track("level_complete", event);

Teliqos::shutdown();
return 0;
}
```

## Integration

### CMake FetchContent (recommended)

```cmake
include(FetchContent)
FetchContent_Declare(teliqos
GIT_REPOSITORY https://github.com/CedraInteractive/teliqos-sdk-cpp.git
GIT_TAG v0.1.0)
FetchContent_MakeAvailable(teliqos)
target_link_libraries(your_game PRIVATE teliqos)
```

### CMake (add_subdirectory)

```cmake
add_subdirectory(teliqos-sdk-cpp)
target_link_libraries(your_game PRIVATE teliqos)
```

### Platform Support

| Platform | Arch | Compiler | SSL Backend | CI Tested | Prebuilt |
|----------|------|----------|-------------|-----------|----------|
| Windows 10+ | x64 | MSVC 17+ | Schannel | ✅ | ✅ |
| macOS 13+ | arm64 | Apple Clang 15+ | SecureTransport | ✅ | ✅ |
| Ubuntu 22.04+ | x64 | GCC 11+ / Clang 14+ | OpenSSL | ✅ | ✅ |

> **Game engines:** Tested with raylib 5.x. Unreal Engine integration available via [teliqos-sdk-unreal](https://github.com/CedraInteractive/teliqos-sdk-unreal) (coming soon).

### Dependencies

All dependencies are handled automatically — no manual installation required:

| Dependency | Method | Purpose |
|-----------|--------|---------|
| [libcurl](https://curl.se/) | CMake FetchContent | HTTPS transport |
| [nlohmann/json](https://github.com/nlohmann/json) | CMake FetchContent | JSON serialization |
| [SQLite3](https://sqlite.org/) | Bundled (`third_party/`) | Offline event queue |

## Build from Source

```bash
git clone https://github.com/CedraInteractive/teliqos-sdk-cpp.git
cd teliqos-sdk-cpp
cmake -B build
cmake --build build
```

### Run Tests

```bash
cmake -B build -DTELIQOS_BUILD_TESTS=ON
cmake --build build
cd build && ctest --output-on-failure
```

## API Reference

| Function | Description |
|----------|-------------|
| `Teliqos::init(config)` | Initialize the SDK, start session and background threads |
| `Teliqos::shutdown()` | Flush remaining events, end session, clean up |
| `Teliqos::identify(playerId)` | Set the player identity |
| `Teliqos::track(name, data)` | Send a custom event |
| `Teliqos::setUserProperty(key, value)` | Attach metadata to every subsequent event |
| `Teliqos::setOptOut(true)` | Disable all tracking (GDPR / Apple ATT) |
| `Teliqos::flush()` | Force-send all queued events |
| `Teliqos::getStatus()` | Get queue size, offline count, and quota info |

## Configuration

```cpp
Teliqos::Config config;
config.apiKey = "mq_live_..."; // Required
config.appVersion = "1.0.0"; // Recommended
config.endpoint = "https://api.teliqos.io"; // Default
config.batchIntervalMs = 30000; // Flush every 30s
config.batchSize = 50; // Flush at 50 events
config.collectDeviceInfo = true; // Auto-collect OS/CPU/RAM
config.offlineQueueSize = 500; // Max offline events
config.heartbeatIntervalSec = 60; // Heartbeat interval
config.debug = false; // Enable console logging
```

## Event Tracking

```cpp
Teliqos::EventData event;

// Numeric values
event.nums["damage"] = 25.5;
event.nums["health"] = 100.0;

// String values
event.strs["weapon"] = "sword";
event.strs["boss_id"] = "dragon_01";

// Tags
event.tags = {"pvp", "ranked"};

// Position (for heatmaps)
event.pos = {120.0f, 45.0f, 0.0f};
event.hasPos = true;

// Map identifier
event.mapId = "world_1";

// Event category (session, performance, gameplay, economy, system, custom)
event.category = "gameplay";

Teliqos::track("boss_fight", event);
```

## User Properties

Properties set via `setUserProperty` are automatically attached to every subsequent event:

```cpp
Teliqos::setUserProperty("tier", "gold"); // string → strs map
Teliqos::setUserProperty("player_level", 42.0); // number → nums map
```

## Privacy

```cpp
Teliqos::setOptOut(true); // Stops all tracking, clears event queue
Teliqos::setOptOut(false); // Resumes tracking
```

## License

MIT — see [LICENSE](LICENSE) for details.