-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathllms.txt
More file actions
151 lines (112 loc) · 4.27 KB
/
llms.txt
File metadata and controls
151 lines (112 loc) · 4.27 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
# Aptabase C++ SDK
> C++ SDK for Aptabase — privacy-first analytics for desktop, server, and game applications. Open source, GDPR compliant, no cookies. Requires C++17. Pluggable HTTP backends (cpp-httplib or Boost.Asio).
## Installation
Add as a CMake subdirectory. You must supply HTTP backend dependencies yourself.
**With cpp-httplib:**
```cmake
# Include cpp-httplib and OpenSSL in your project first
set(CMAKE_APTABASE_USE_HTTPLIB ON)
add_subdirectory(path/to/aptabase-cpp)
target_link_libraries(YourApp PRIVATE AptabaseCpp)
```
**With Boost.Asio:**
```cmake
# Include Boost and OpenSSL in your project first
set(CMAKE_APTABASE_USE_BOOST ON)
add_subdirectory(path/to/aptabase-cpp)
target_link_libraries(YourApp PRIVATE AptabaseCpp)
```
## Initialization
```cpp
#include <aptabase/analytics.hpp>
#include <aptabase/net/httplib.hpp> // or <aptabase/net/boost.hpp>
// Create the Analytics instance with an HTTP client, app key, API URL, and debug flag
Aptabase::Analytics aptabase(
std::make_unique<Aptabase::HttplibHttpClient>(), // or BoostHttpClient
"A-US-1234567890", // your app key
"https://us.aptabase.com", // API URL (eu/us/self-hosted)
true // is_debug
);
```
## Session Management
Sessions must be explicitly started and ended. A unique session ID is generated per `StartSession` call, or you can provide a custom one.
```cpp
aptabase.StartSession();
// ... record events ...
aptabase.EndSession();
// Or with a custom session ID:
aptabase.StartSession("my-custom-session-id");
```
## Track Events
```cpp
aptabase.StartSession();
aptabase.RecordEvent("app_started");
aptabase.EndSession();
```
## Track Events with Properties
Event attributes support `std::string`, `float`, and `double` value types via `std::variant`.
```cpp
aptabase.RecordEvent("level_completed", {
{"level", std::string("forest")},
{"score", 9500.0},
{"time_seconds", 42.5f}
});
```
## Providers (Event Dispatch Strategy)
The SDK uses a Provider abstraction to control when events are sent to the server.
**AutoProvider** (default): Sends events immediately on each `RecordEvent` call.
**ManualProvider**: Queues events and sends them only when you call `Flush()`. Max 25 events per request.
```cpp
#include <aptabase/provider/manual_provider.hpp>
Aptabase::Analytics aptabase(
std::make_unique<Aptabase::ManualProvider>(
std::make_unique<Aptabase::HttplibHttpClient>(),
"A-US-1234567890",
"https://us.aptabase.com"
),
true // is_debug
);
aptabase.StartSession();
aptabase.RecordEvent("event1");
aptabase.RecordEvent("event2");
aptabase.Flush(); // sends queued events
aptabase.EndSession();
```
**WorkerProvider**: Runs a background thread that flushes events on a configurable interval.
```cpp
#include <aptabase/provider/worker_provider.hpp>
Aptabase::Analytics aptabase(
std::make_unique<Aptabase::WorkerProvider>(
std::make_unique<Aptabase::HttplibHttpClient>(),
"A-US-1234567890",
"https://us.aptabase.com"
),
true // is_debug
);
```
## Configuration
System properties can be set at runtime:
```cpp
aptabase.SetAppVersion("1.2.0");
aptabase.SetLocale("en-US");
aptabase.SetOsName("Windows");
aptabase.SetOsVersion("11.0");
aptabase.SetDebug(false);
```
| Method | Description |
|---|---|
| `SetAppVersion` | Application version string (default: "1.0.0") |
| `SetLocale` | User locale (default: "en-US") |
| `SetOsName` | Operating system name (default: "Unknown") |
| `SetOsVersion` | OS version string (default: "0.0.0") |
| `SetDebug` | Toggle debug mode at runtime |
| `SetLog` | Custom log callback: `void(Verbosity, const std::string&)` |
## Platform Notes
- Requires **C++17** (`cxx_std_17`)
- No built-in platform detection — you must set OS name/version/locale yourself
- HTTP backend is pluggable: choose cpp-httplib or Boost.Asio, or implement `Aptabase::HttpClient` interface
- Max 25 events per API request (enforced by `HttpClient::MaxEventsPerRequest`)
- Namespace: `Aptabase::` (classes: `Analytics`, `Event`, `EventAttribute`, providers, HTTP clients)
- Event attribute values are `std::variant<std::string, float, double>` — no int or bool support
## Cross-Discovery
For all Aptabase SDKs (Swift, Kotlin, Flutter, React Native, Electron, Tauri, and more), see https://aptabase.com/llms.txt