Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 11 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ include(FetchContent)
FetchContent_Declare(
scarf_cpp
GIT_REPOSITORY https://github.com/scarf-sh/cpp-sdk.git
GIT_TAG main # replace with a release tag once available
GIT_TAG v0.1.0
)
FetchContent_MakeAvailable(scarf_cpp)

Expand Down Expand Up @@ -46,10 +46,10 @@ int main() {
scarf::EventLogger logger("https://your-scarf-endpoint.com");

scarf::LogResult result = logger.log_event({
{"event", "custom_event"},
{"package", "my-package"},
{"version", "1.2.3"},
{"metadata", scarf::PropertyValue::Object{{"channel", "stable"}}},
{"sdk", "scarf-cpp"},
{"release", "v0.1.0"},

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Preserve the recognized version field in events

When users copy this Scarf Gateway/Event Collection example, sending release instead of the recognized version/$version field means the event can still be accepted but Scarf will not populate its package-version analytics/export dimension unless the endpoint has a custom mapping. The guidance was meant to avoid overloading event/package, but dropping the version field regresses the release-segmentation data the previous example produced; keep a documented version field alongside the metadata-style names.

Useful? React with 👍 / 👎.

{"source", "my-application"},
{"metadata", scarf::PropertyValue::Object{{"channel", "stable"}, {"feature", "install"}}},
});

return result.success ? 0 : 1;
Expand All @@ -58,6 +58,10 @@ int main() {

`log_event` sends a `POST` request to the configured endpoint with `Content-Type: application/json`. Event properties are encoded as a JSON request body so strings, numbers, booleans, arrays, objects, and nulls round-trip without query-string encoding.

When sending events through the Scarf gateway, use metadata-style property names that describe your client or integration. Avoid overloading common event-processing names such as `event` and `package` unless your Scarf endpoint is configured to expect them.

Scarf analytics are processed asynchronously. A successful gateway response means the event was accepted, but it can take a couple of hours before the event appears in analytics exports or dashboard views.

## Configuration

The client follows the same defaults as the other Scarf SDKs:
Expand Down Expand Up @@ -88,6 +92,8 @@ ctest --test-dir build --output-on-failure

The test suite does not make network calls; it uses an injected transport to validate request construction, opt-out behavior, errors, and the User-Agent format.

CI currently validates Linux and macOS builds. Windows/MSVC support is intended by the CMake configuration but is not yet covered by CI.

## License

Apache 2.0
Loading