跳到正文
Feralin

开发者

C / C++ native:快速开始

使用 C / C++ native 向 Feralin 发送事件的安装与首次使用步骤。代码示例取自 SDK 自带的 README,状态来自能力记录。

安装

feralin 0.1.0 已在 CMake FetchContent + Git etiketi 发布;请用下方命令通过包管理器安装。

include(FetchContent)
FetchContent_Declare(
  feralin
  GIT_REPOSITORY https://github.com/feralincom/sdk.git
  GIT_TAG        sdks/cpp/v0.1.0
  GIT_SHALLOW    TRUE
  SOURCE_SUBDIR  sdks/cpp)
FetchContent_MakeAvailable(feralin)
target_link_libraries(uygulamam PRIVATE feralin::feralin)
cmake -S sdks/cpp -B sdks/cpp/build -DCMAKE_BUILD_TYPE=Release
cmake --build sdks/cpp/build
cmake --install sdks/cpp/build --prefix /opt/feralin
find_package(feralin CONFIG REQUIRED)     # -DCMAKE_PREFIX_PATH=/opt/feralin
target_link_libraries(uygulamam PRIVATE feralin::feralin)

首次使用

#include <feralin/feralin.hpp>

feralin::Options options;
options.project_key = "pk_live_...";                 // sk_ reddedilir
options.collect_url = "https://collect.example.com";
options.consent.analytics = true;                    // kullanıcıdan alınan izin; varsayılan kapalı

auto client = feralin::Client::create(options);      // geçersiz seçenekte nullptr
client->track("order_completed", {{"order_id", "ord_1"}, {"amount", 249.9}});
feralin::FlushResult result = client->close();       // kalan olayları en fazla 5 sn içinde gönderir
#include <feralin/feralin.h>

feralin_options options;
feralin_options_init(&options);
options.project_key = "pk_live_...";
options.collect_url = "https://collect.example.com";
options.consent = FERALIN_CONSENT_ANALYTICS;

feralin_client* client = NULL;
if (feralin_client_new(&options, &client) != FERALIN_OK) { /* feralin_last_error() */ }

feralin_props* props = feralin_props_new();
feralin_props_set_string(props, "order_id", "ord_1");
feralin_track(client, "order_completed", props, NULL, NULL);
feralin_props_free(props);
feralin_client_free(client);  /* kapatır, kalan olayları göndermeyi dener */

代码示例原样取自 sdks/cpp/README.md 文件,其中的注释可能是土耳其语。项目密钥由你在控制台中创建。

能力

C / C++ native 的能力状态
能力状态
事件发送支持
批量发送部分支持
同意管理支持
身份标识部分支持
归因不适用
深度链接不适用
收入部分支持
错误捕获部分支持
会话录制不适用
链路追踪已规划

验证链

C / C++ native 的验证链
环节状态
源码通过
构建通过
测试通过
包仓库发布通过
全新安装通过
事件回执通过
文档通过
Super Admin 证据未开始

通过指的是本地证据:源码、构建与测试都已运行。包仓库发布与 Super Admin 证据是独立的环节;只要有一个未通过,该 SDK 就不算就绪。