리포지토리에 연결
GitHub

앱스플라이어 Unreal 스팀 SDK 연동

는 앱스플라이어크로스 플랫폼 어트리뷰션을 수행할 수 있는 강력한 도구를 제공하여 게임 마케터가 더 나은 결정을 내릴 수 있도록 지원합니다.

게임 어트리뷰션을 위해서는 게임이 첫 번째 열기, 연속 세션 및 인앱이벤트를 기록하는 앱스플라이어 SDK를 연동해야 합니다. 예를 들어 구매 이벤트입니다.
앱스플라이어 SDK를 Unreal Steam 게임에 통합하기 위한 참고 자료로 이 샘플 앱을 사용하는 것이 좋습니다. 참고: 다음 샘플 코드는 현재 Windows 환경에서만 지원됩니다.


Prerequisites

  • Unreal 엔진 4.2x
  • Steamworks SDK 는 UE4 에 통합되어 있습니다 (보통 UE4 서드 파티에 포함되어 있어 다운로드할 필요가 없습니다).
  • Steam 클라이언트를 활성 사용자와 함께 인스톨합니다.

AppsflyerSteamModule - 인터페이스

AppsflyerSteamModule.happsflyer-unreal-steam-sample-app/AppsflyerSteamIntegrationFiles/AppsflyerSteamModule 폴더에 있으며 앱스플라이어 서버에 연결하고 이벤트를 리포트하는 데 필요한 코드 및 논리가 포함되어 있습니다.

Init

이 메서드는 API 키와 앱 ID를 수신하고 앱스플라이어 모듈을 초기화합니다.

Method signature

void Init(const char* devkey, const char* appID)

Usage:

AppsflyerSteamModule()->Init(<< DEV_KEY >>, << STEAM_APP_ID>>);

Arguments:

Start

이 메서드는 앱스플라이어에 first open 및 /session 요청을 보냅니다.

Method signature

void Start(bool skipFirst = false)

Usage:

// without the flag
AppsflyerSteamModule()->Start();

// with the flag
bool skipFirst = [SOME_CONDITION];
AppsflyerSteamModule()->Start(skipFirst);

LogEvent

이 메서드는 이벤트 이름과 JSON 객체를 수신하고 앱스플라이어에 인앱이벤트를 보냅니다.

Method signature

void LogEvent(std::string event_name, json event_parameters)

Usage:

//set event name
std::string event_name = "af_purchase";
//set json string
std::string event_parameters = "{\"af_currency\":\"USD\",\"af_price\":6.66,\"af_revenue\":24.12}";
AppsflyerSteamModule()->LogEvent(event_name, event_parameters);

GetAppsFlyerUID

앱스플라이어의 고유 기기 ID를 가져옵니다. SDK는 앱 설치 시 앱스플라이어의 고유 기기 ID를 생성합니다. SDK가 시작되면 이 ID가 첫 번째 앱 인스톨의 ID로 기록됩니다.

Method signature

std::string GetAppsFlyerUID()

Usage:

AppsflyerSteamModule()->GetAppsFlyerUID();

IsInstallOlderThanDate

이 메서드는 날짜 문자열을 수신하고 게임 폴더 수정 날짜가 날짜 문자열보다 오래된 경우 true를 반환합니다. 날짜 문자열 형식은 "2023-January-01 23:12:34"입니다.

Method signature

bool IsInstallOlderThanDate(std::string datestring)

Usage:

// the modification date in this example is "2023-January-23 08:30:00"

// will return false
bool dateBefore = AppsflyerSteamModule()->IsInstallOlderThanDate("2023-January-01 23:12:34");

// will return true
bool dateAfter = AppsflyerSteamModule()->IsInstallOlderThanDate("2023-April-10 23:12:34");

// example usage with skipFirst -
// skipping if the install date is NOT older than the given date
bool isInstallOlderThanDate = AppsflyerSteamModule()->IsInstallOlderThanDate("2023-January-10 23:12:34");
AppsflyerSteamModule()->Start(!isInstallOlderThanDate);

샘플 앱 실행

  1. UE4 엔진을 엽니다.
  2. 신규 프로젝트 -> 게임 -> 1인칭 게임을 선택합니다.
  3. C++ 를 선택합니다(Blueprints 대신).
  4. 프로젝트 이름을 AppsFlyerSample 로 지정하고 프로젝트 생성을 클릭합니다.
  5. 지침에 따라 Steam 게임에서 앱스플라이어를 구현하십시오.
  6. UE4 엔진 에디터에서 샘플 앱을 실행합니다.
  7. 24시간 후 대시보드가 업데이트되고 오가닉 및 논오가닉 인스톨과 인앱이벤트가 표시됩니다.

Steam 게임에서 앱스플라이어 구현하기

Setup

  1. Steam이 UE4 서드 파티에 있는지 확인합니다. 더 알아보기
  2. 다음 정의를 Config/DefaultEngine.ini. 자세한 내용은 appsflyer-unreal-steam-sample-app/AppsflyerSteamIntegrationFiles/DefaultEngine.ini file.
+NetDriverDefinitions=(DefName="GameNetDriver",DriverClassName="OnlineSubsystemSteam.SteamNetDriver",DriverClassNameFallback="OnlineSubsystemUtils.IpNetDriver")
DefaultPlatformService=Steam
bEnabled=true
SteamDevAppId=480 //replace "480" with your steam app id.
NetConnectionClassName="OnlineSubsystemSteam.SteamNetConnection"
  1. Unreal 에디터에서 플러그인으로 이동하여 Online Subsystem Steam을 활성화한 뒤 에디터를 재시작합니다.
  2. 선호하는 C ++ 편집기에서 프로젝트를 연 다음 [YOUR-APP-NAME].Build.cs 파일에 OpenSSL, OnlineSubsystem, 및 OnlineSubsystemSteam 사용자의 의존성 및 HTTP 비공개 종속성으로:
PublicDependencyModuleNames.AddRange(new string[] { "Core", "CoreUObject", "Engine", "InputCore", "HeadMountedDisplay", "OpenSSL", "OnlineSubsystem", "OnlineSubsystemSteam" });
PrivateDependencyModuleNames.Add("HTTP");
  1. Unreal 프로젝트 파일의 Source 디렉토리 아래에 AppsflyerSteamModule이라는 새 디렉토리를 생성합니다.
  2. 여기서 appsflyer-unreal-steam-sample-app/AppsflyerSteamIntegrationFiles/AppsflyerSteamModule 의 다음 파일을 새 폴더로 복사합니다:
  • AppsflyerModule.cpp
  • AppsflyerSteamModule.cpp
  • AppsflyerSteamModule.h
  • DeviceID.h
  • RequestData.h
  1. OpenSSL을 추가할 프로젝트 파일을 생성합니다. 더 알아보기.
  2. 다음 GameMode.h 파일에서 다음 함수를 엽니다: StartPlay() function:
UCLASS(minimalapi)
class AAppsFlyerSampleGameMode : public AGameModeBase
{
 GENERATED_BODY()

public:
 AAppsFlyerSampleGameMode();
 virtual void StartPlay() override;
};

  1. Source/AppsFlyerSample/AppsFlyerSampleGameMode.cpp 파일을 열고 다음을 다음 파일에 추가합니다: GameMode.cpp file:
#include "AppsflyerSteamModule/AppsflyerSteamModule.cpp"
  1. 다음 함수를 추가하고 DEV_KEY and STEAM_APP_ID in the init 함수에 들어 있음)을 앱 세부정보로 교체했는 지 확인하십시오.
void AAppsFlyerSampleGameMode::StartPlay()
{
 Super::StartPlay();
 if (SteamAPI_Init()) {
  // init the AF module
  AppsflyerSteamModule()->Init(<< DEV_KEY >>, << STEAM_APP_ID>>)

  // check whether the install date was not older than 2023-January-02 23:12:34
  bool isInstallOlderThanDate = AppsflyerSteamModule()->IsInstallOlderThanDate("2023-January-02 23:12:34");

  // send the firstOpen/session event (if the install date is not older than the given date, the AF module will skip the first-open event)
  AppsflyerSteamModule()->Start(!isInstallOlderThanDate);

  // Use the following code to send in-app event
  // set event name
  std::string event_name = "af_purchase";
  // set json string
  std::string event_parameters = "{\"af_currency\":\"USD\",\"af_price\":6.66,\"af_revenue\":24.12}";
  AppsflyerSteamModule()->LogEvent(event_name, event_parameters);
 }
}
  1. 앱스플라이어 연동을 초기화하고 시작합니다.
  2. 인앱 이벤트를 리포트합니다.

Adding SteamVR Support

Please use the following guide in order to integrate your steam game with MetaXR

스팀 클라우드 저장 삭제(어트리뷰션 재설정)

  1. 스팀 클라우드 비활성화.
  2. Delete the local files and the appsflyer_info file:

Delete the