Epic C++
AppsFlyer Epic C++ SDK実装
AppsFlyerは、クロスプラットフォームアトリビューション、モバイルおよびウェブ分析、ディープリンク、不正検出、プライバシー管理と保全など、実際のペインポイントを解決する強力なツールを提供することで、ゲームマーケティング担当者がより良い意思決定を行えるように支援します。
ゲームのアトリビューションには、ゲームがHTTPSでAppsFlyerのAPIと通信し、初回起動、連続セッション、アプリ内イベントなどのユーザーアクティビティをレポートすることが必要です。(例:購入など)このサンプルアプリは、ユーザーのアクティビティをレポートするコードをC++に実装するためのリファレンスとして使用することをお勧めします。注:以下のサンプルコードは、現在、Windows環境でのみサポートされています。
前提条件:
vcpkg openssl & nlohmann-jsonパッケージ:
vcpkg install nlohmann-json:x86-windows
vcpkg install openssl:x86-windows</code></pre>
AppsflyerLauncherModule - Interface
AppsflyerLauncherModule.h
, included in the appsflyer-module
folder, contains the required code and logic to connect to AppsFlyer servers and report events.
Init
このメソッドは、お客様のAPIキーとアプリIDを受け取り、AppsFlyer Moduleを初期化します。
メソッドのシグネチャ
void init(const char* devkey, const char* appID)
例:
AppsflyerLauncherModule()->init("DEV_KEY", "STEAM_APP_ID");
Arguments:
STEAM_APP_ID
SteamDBから取得できます。DEV_KEY
: Get from the marketer or AppsFlyer HQ.
Start
このメソッドは、first open / session(初回起動 / セッション)リクエストをAppsFlyerに送信します。
メソッドのシグネチャ
void start(bool skipFirst = false)
例:
// without the flag
AppsflyerLauncherModule()->start();
// with the flag
bool skipFirst = [SOME_CONDITION];
AppsflyerLauncherModule()->start(skipFirst);
LogEvent
このメソッドは、イベント名とJSONオブジェクトを受け取り、アプリ内イベントをAppsFlyerに送信します。
メソッドのシグネチャ
void logEvent(std::string event_name, json event_values)
例:
json event_values = { {"af_currency", "USD"}, {"af_price", 6.66}, {"af_revenue", 24.12} };
std::string event_name = "af_purchase";
AppsflyerLauncherModule()->logEvent(event_name, event_values);
注意:JSONを使用するためには、必ず以下のインポートを使用してください:
#include <nlohmann/json.hpp>
using json = nlohmann::json;
サンプルアプリの実行
- Visual Studioをインストールします。
- ソリューションを開く
- Open the
AppsflyerSampleApp.cpp
file. - On line 112, replace
DEV_KEY
andAPP_ID
with your app details. - 上部のツールバー(Local Windows Debugger)のPlayをクリックして、アプリを実行します。モードがDebugに設定されていることを確認します。
- 24時間後にダッシュボードが更新され、オーガニックとノンオーガニックのインストールとアプリ内イベントが表示されます。
C++アプリにAppsFlyerを実装する
Setup
- Copy the files from the
appsflyer-module
folder into your C++ project under Header Files > AppsFlyer. - モジュールをインポート:
#include "AppsflyerLauncherModule.h"
- インポート
nlohmann-json
:
#include <nlohmann/json.hpp>
using json = nlohmann::json;
- AppsFlyer連携をInitialize(初期化)しstart(開始)します。
- Report in-app events.
更新済 9日前