GitHubレポジトリへのリンク

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_IDSteamDBから取得できます。
  • 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;

サンプルアプリの実行

  1. Visual Studioをインストールします。
  2. ソリューションを開く
  3. Open the AppsflyerSampleApp.cpp file.
  4. On line 112, replace DEV_KEY and APP_ID with your app details.
  5. 上部のツールバー(Local Windows Debugger)のPlayをクリックして、アプリを実行します。モードがDebugに設定されていることを確認します。
  6. 24時間後にダッシュボードが更新され、オーガニックとノンオーガニックのインストールとアプリ内イベントが表示されます。

C++アプリにAppsFlyerを実装する

Setup

  1. Copy the files from the appsflyer-module folder into your C++ project under Header Files > AppsFlyer.
  2. モジュールをインポート:
#include "AppsflyerLauncherModule.h"
  1. インポート nlohmann-json:
#include &lt;nlohmann/json.hpp>
using json = nlohmann::json;
  1. AppsFlyer連携をInitialize(初期化)しstart(開始)します。
  2. Report in-app events.