Unity Epic
리포지토리에 연결
GitHub
앱스플라이어 Unity Epic SDK 연동
는 앱스플라이어크로스 플랫폼 어트리뷰션을 수행할 수 있는 강력한 도구를 제공하여 게임 마케터가 더 나은 결정을 내릴 수 있도록 지원합니다.
게임 어트리뷰션을 위해서는 게임이 첫 번째 열기, 연속 세션 및 인앱이벤트를 기록하는 앱스플라이어 SDK를 연동해야 합니다. 예를 들어 구매 이벤트입니다.
앱스플라이어 SDK를 Unity Epic 게임에 통합하기 위한 참고 자료로 이 샘플 앱을 사용하는 것이 좋습니다.
AppsflyerEpicModule - 인터페이스
AppsflyerEpicModule.cs
는 scenes 폴더에 들어 있으며 앱스플라이어 서버에 연결하고 이벤트를 리포트하는 데 필요한 코드와 로직이 포함되어 있습니다.
AppsflyerEpicModule
This method receives your API key, app ID, the parent MonoBehaviour and a sandbox mode flag (optional, false by default) and initializes the AppsFlyer Module.
Method signature
AppsflyerEpicModule(string appid, string devkey, MonoBehaviour mono, bool isSandbox = false)
Usage:
// for regular init
AppsflyerEpicModule afm = new AppsflyerEpicModule(<< DEV_KEY >>, << EPIC_APP_ID >>, this);
// for init in sandbox mode (reports the events to the sandbox endpoint)
AppsflyerEpicModule afm = new AppsflyerEpicModule(<< DEV_KEY >>, << EPIC_APP_ID >>, this, true);
Arguments:
DEV_KEY
: 마케터 또는 앱스플라이어 본사에서 얻을 수 있습니다.EPIC_APP_ID
: Epic 스토어 링크에서 찾을 수 있습니다.MonoBehaviour mono
:bool isSandbox
: Whether to activate sandbox mode. False by default.
Start
이 메서드는 앱스플라이어에 first open/session 요청을 보냅니다.
Method signature
void Start(bool skipFirst = false)
Usage:
// without the flag
afm.Start();
// with the flag
bool skipFirst = [SOME_CONDITION];
afm.Start(skipFirst);
Stop
Once this method is invoked, our SDK no longer communicates with our servers and stops functioning.
Useful when implementing user opt-in/opt-out.
Method signature
void Stop()
Usage:
// Starting the SDK
afm.Start();
// ...
// Stopping the SDK, preventing further communication with AppsFlyer
afm.Stop();
LogEvent
이 메서드는 이벤트 이름과 JSON 객체를 수신하고 앱스플라이어에 인앱이벤트를 보냅니다.
Method signature
void LogEvent(string event_name, Dictionary<string, object> event_parameters)
Usage:
// set event name
string event_name = "af_purchase";
// set event values
Dictionary<string, object> event_parameters = new Dictionary<string, object>();
event_parameters.Add("af_currency", "USD");
event_parameters.Add("af_price", 6.66);
event_parameters.Add("af_revenue", 12.12);
// send logEvent request
afm.LogEvent(event_name, event_parameters);
IsInstallOlderThanDate
This method receives a date string and returns true if the game folder creation date is older than the date string. The date string format is: "2023-03-13T10:00:00+00:00"
Method signature
bool IsInstallOlderThanDate(string datestring)
Usage:
// the creation date in this example is "2023-03-23T08:30:00+00:00"
bool newerDate = afm.IsInstallOlderThanDate("2023-06-13T10:00:00+00:00");
bool olderDate = afm.IsInstallOlderThanDate("2023-02-11T10:00:00+00:00");
// will return true
Debug.Log("newerDate:" + (newerDate ? "true" : "false"));
// will return false
Debug.Log("olderDate:" + (olderDate ? "true" : "false"));
// example usage with skipFirst -
// skipping if the install date is NOT older than the given date
bool IsInstallOlderThanDate = afm.IsInstallOlderThanDate("2023-02-11T10:00:00+00:00");
afm.Start(!IsInstallOlderThanDate);
GetAppsFlyerUID
앱스플라이어의 고유 기기 ID를 가져옵니다. SDK는 앱 설치 시 앱스플라이어의 고유 기기 ID를 생성합니다. SDK가 시작되면 이 ID가 첫 번째 앱 인스톨의 ID로 기록됩니다.
Method signature
void GetAppsFlyerUID()
Usage:
AppsflyerEpicModule afm = new AppsflyerEpicModule(<< DEV_KEY >>, << EPIC_APP_ID >>, this);
afm.Start();
string af_uid = afm.GetAppsFlyerUID();
SetCustomerUserId
Setting your own customer ID enables you to cross-reference your own unique ID with AppsFlyer’s unique ID and other devices’ IDs.
This ID is available in raw-data reports and in the Postback APIs for cross-referencing with your internal IDs.
Can be used only before calling Start()
.
Method signature
void SetCustomerUserId(string cuid)
Usage:
AppsflyerEpicModule afm = new AppsflyerEpicModule(DEV_KEY, STEAM_APP_ID, this);
afm.SetCustomerUserId("15667737-366d-4994-ac8b-653fe6b2be4a");
afm.Start();
샘플 앱 실행
- Unity 허브를 열고 프로젝트를 엽니다.
- 이
AppsflyerEpicScript.cs
and update it with your DEV_KEY and APP_ID (in the gaming object).
- AppsflyerEpicScript를 빈 게임 오브젝트에 추가합니다(또는 scenes 폴더에 있는 오브젝트 사용).
- Unity 편집기를 통해 샘플 앱을 실행하고 디버그 로그에 다음 메시지가 표시되는지 확인합니다.
- 24시간 후 앱스플라이어 대시보드가 업데이트되고 오가닉 및 논오가닉 인스톨과 인앱이벤트가 표시됩니다.
Epic 게임에서 앱스플라이어 구현하기
Setup
- Unity 프로젝트에 EOS를 추가합니다. Epic 온라인 서비스 유니티 플러그인의 안내에 따라 패키지 관리자를 통해 추가합니다.
- Add
EOSManager.cs
를 게임 개체로 설정합니다. - 스크립트를
Assets/Scenes/AppsflyerEpicModule.cs
에서 앱으로 추가합니다. - 이
Assets/Scenes/AppsflyerEpicScript.cs
의 샘플 코드를 사용하여 다음을 업데이트 합니다:DEV_KEY
andAPP_ID
. - SDK 초기화.
AppsflyerEpicModule afm = new AppsflyerEpicModule(<< DEV_KEY >>, << EPIC_APP_ID >>, this);
Resetting the attribution
- Delete the PlayerPrefs data the registry/preferences folder, or use PlayerPrefs.DeleteAll() when testing the attribution in the UnityEditor.
최신 데이터 19일 전