리포지토리에 연결
GitHub

앱스플라이어 Unreal Epic SDK 연동

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

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

Prerequisites

  • Unreal 엔진 4.2x
  • EOS Subsystem은 UE4 에 통합되어 있습니다 (보통 UE4 서드 파티에 포함되어 있어 다운로드할 필요가 없습니다).

AppsflyerEpicModule - 인터페이스

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

Init

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

Method signature

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

Usage:

AppsflyerEpicModule()->Init(<< DEV_KEY >>, << EPIC_APP_ID >>);

Arguments:

Start

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

Method signature

void Start(bool skipFirst = false)

Usage:

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

// with the flag
bool skipFirst = [SOME_CONDITION];
AppsflyerEpicModule()->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}";
AppsflyerEpicModule()->LogEvent(event_name, event_parameters);

GetAppsFlyerUID

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

Method signature

std::string GetAppsFlyerUID()

Usage:

AppsflyerEpicModule()->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 = AppsflyerEpicModule()->IsInstallOlderThanDate("2023-January-01 23:12:34");

// will return true
bool dateAfter = AppsflyerEpicModule()->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 = AppsflyerEpicModule()->IsInstallOlderThanDate("2023-January-10 23:12:34");
AppsflyerEpicModule()->Start(!isInstallOlderThanDate);

샘플 앱 실행

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

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

Setup

  1. Epic이 UE4 서드 파티에 있는지 확인합니다. 더 알아보기
  2. 다음 정의를 Config/DefaultEngine.ini 그리고 confidential 자격 증명을 EOS 자격 증명으로 교체하십시오. 자세한 내용은 appsflyer-unreal-Epic-sample-app/AppsflyerEpicIntegrationFiles/DefaultEngine.ini file.
[OnlineSubsystem]
DefaultPlatformService=EOSPlus

[OnlineSubsystemEOS]
bEnabled=true

[OnlineSubsystemEOSPlus]
bEnabled=true

[/Script/OnlineSubsystemEOS.NetDriverEOS]
bIsUsingP2PSockets=true
NetConnectionClassName="OnlineSubsystemEOS.NetConnectionEOS"

[/Script/OnlineSubsystemEOS.EOSSettings]
CacheDir=CacheDir
DefaultArtifactName=Confidential
TickBudgetInMilliseconds=0
bEnableOverlay=False
bEnableSocialOverlay=False
bShouldEnforceBeingLaunchedByEGS=False
TitleStorageReadChunkLength=0
+Artifacts=(ArtifactName="Confidential",ClientId="Confidential",ClientSecret="Confidential",ProductId="Confidential",SandboxId="Confidential",DeploymentId="Confidential",EncryptionKey="Confidential")
bUseEAS=False
bUseEOSConnect=True
bMirrorStatsToEOS=False
bMirrorAchievementsToEOS=False
bUseEOSSessions=True
bMirrorPresenceToEAS=False
  1. In your Unreal editor, go to Plugins, activate Online Subsystem EOS, and then restart the editor.
  2. 선호하는 C ++ 편집기에서 프로젝트를 연 다음 [YOUR-APP-NAME].Build.cs 파일에 OpenSSL, OnlineSubsystem, 및 OnlineSubsystemEOS 사용자의 의존성 및 HTTP 비공개 종속성으로:
PublicDependencyModuleNames.AddRange(new string[] { "Core", "CoreUObject", "Engine", "InputCore", "HeadMountedDisplay", "OpenSSL", "OnlineSubsystem", "OnlineSubsystemEOS" });
PrivateDependencyModuleNames.Add("HTTP");
  1. In your Unreal Project files, under the Source directory, create a new directory named AppsflyerEpicModule.

  2. 여기서 appsflyer-unreal-epic-sample-app/AppsflyerEpicIntegrationFiles/AppsflyerEpicModule 의 다음 파일을 새 폴더로 복사합니다:

    • AppsflyerModule.cpp
    • AppsflyerEpicModule.cpp
    • AppsflyerEpicModule.h
    • DeviceID.h
    • RequestData.h
  3. OpenSSL을 추가할 프로젝트 파일을 생성합니다. 더 알아보기

  4. 다음 GameMode.h 파일에서 다음 함수를 엽니다: StartPlay() 함수:

UCLASS(minimalapi)
class AAppsFlyerSampleGameMode : public AGameModeBase
{
 GENERATED_BODY()

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

  1. Source/AppsFlyerSample/AppsFlyerSampleGameMode.cpp 파일을 열고 다음 #include 파일을 GameMode.cpp 파일에 포함하십시오.
#include "AppsflyerEpicModule/AppsflyerEpicModule.cpp"
#include <ThirdParty/EOSSDK/SDK/Include/eos_init.h>
#include <ThirdParty/EOSSDK/SDK/Include/eos_sdk.h>
#include <EOSSDK/SDK/Include/eos_userinfo.h>
using Super = AGameModeBase;
  1. 다음 함수를 추가하고 DEV_KEY and EPIC_APP_ID in the init 함수를 앱 세부 사항으로 바꾸고 EOS SDK를 EOS 세부 정보로 초기화합니다.
void AEpicTestGameMode::StartPlay()
{
 Super::StartPlay();

 EOS_InitializeOptions SDKOptions;
 SDKOptions.ApiVersion = EOS_INITIALIZE_API_LATEST;
 SDKOptions.AllocateMemoryFunction = NULL;
 SDKOptions.ReallocateMemoryFunction = NULL;
 SDKOptions.ReleaseMemoryFunction = NULL;
 SDKOptions.ProductName = "PRODUCT_NAME";
 SDKOptions.ProductVersion = "1.0";
 SDKOptions.Reserved = NULL;
 SDKOptions.SystemInitializeOptions = NULL;
 EOS_EResult res = EOS_Initialize(&SDKOptions);

 if (res == EOS_EResult::EOS_Success || res == EOS_EResult::EOS_AlreadyConfigured) {
  EOS_Platform_Options PlatformOptions;
  PlatformOptions.ApiVersion = EOS_PLATFORM_OPTIONS_API_LATEST;
  PlatformOptions.Reserved = NULL;
  PlatformOptions.bIsServer = false;
  PlatformOptions.EncryptionKey = NULL;
  PlatformOptions.OverrideCountryCode = NULL;
  PlatformOptions.OverrideLocaleCode = NULL;
  PlatformOptions.ProductId = "PRODUCT_ID";
  EOS_Platform_ClientCredentials cCreds;
  cCreds.ClientId = "CLIENT_ID";
  cCreds.ClientSecret = "CLIENT_SECRET";
  PlatformOptions.ClientCredentials = cCreds;
  PlatformOptions.SandboxId = "SANDBOX_ID";
  PlatformOptions.DeploymentId = "DEPLOYMENT_ID";
  PlatformOptions.EncryptionKey = "ENCRYPTION_KEY";
  EOS_HPlatform platform = EOS_Platform_Create(&PlatformOptions);

  // af module init
  AppsflyerEpicModule()->Init(<< DEV_KEY >>, << EPIC_APP_ID >>);
  // af send firstopen/session
  AppsflyerEpicModule()->Start();

  //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}";
  // af send inapp event
  AppsflyerEpicModule()->LogEvent(event_name, event_parameters);
 }
 else {
  UE_LOG(LogTemp, Warning, TEXT("EOS FAIL"));
  return;
 }
}
  1. 인앱 이벤트를 리포트합니다.

Resetting the attribtion

Delete the appsflyer_info file:

Delete the