Unity 스팀
리포지토리에 연결
GitHub
앱스플라이어 Unity 스팀 SDK 연동
는 앱스플라이어크로스 플랫폼 어트리뷰션을 수행할 수 있는 강력한 도구를 제공하여 게임 마케터가 더 나은 결정을 내릴 수 있도록 지원합니다.
게임 어트리뷰션을 위해서는 게임이 첫 번째 열기, 연속 세션 및 인앱이벤트를 기록하는 앱스플라이어 SDK를 연동해야 합니다. 예를 들어 구매 이벤트입니다.
앱스플라이어 SDK를 Unity Steam 게임에 통합하기 위한 참고 자료로 이 샘플 앱을 사용하는 것이 좋습니다.
Prerequisites
- Unity 엔진.
- Steamworks SDK - Unity 프로젝트에 연동합니다.
- Steam 클라이언트를 활성 사용자와 함께 인스톨합니다. 참고: 테스트 실행 중이어야 합니다.
AppsflyerSteamModule - 인터페이스
AppsflyerSteamModule.cs
는 scenes 폴더에 들어 있으며 앱스플라이어 서버에 연결하고 이벤트를 리포트하는 데 필요한 코드와 로직이 포함되어 있습니다.
AppsflyerSteamModule
This method receives your API key, Steam app ID, the parent MonoBehaviour and a sandbox mode flag (optional, false by default) and initializes the AppsFlyer Module.
Method signature
AppsflyerSteamModule(
string DEV_KEY,
string STEAM_APP_ID,
MonoBehaviour mono,
bool isSandbox = false,
bool collectSteamUid = true
)
Usage:
// for regular init
AppsflyerSteamModule afm = new AppsflyerSteamModule(DEV_KEY, STEAM_APP_ID, this);
// for init in sandbox mode (reports the events to the sandbox endpoint)
AppsflyerSteamModule afm = new AppsflyerSteamModule(DEV_KEY, STEAM_APP_ID, this, true);
// for init without reporting steam_uid
AppsflyerSteamModule afm = new AppsflyerSteamModule(DEV_KEY, STEAM_APP_ID, this, false, false);
인수
string DEV_KEY
: 마케터 또는 앱스플라이어 본사에서 얻을 수 있습니다.string STEAM_APP_ID
: SteamDB에서 찾을 수 있습니다.MonoBehaviour mono
:bool isSandbox
: Whether to activate sandbox mode. False by default.bool collectSteamUid
: Whether to collect Steam UID or not. True 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);
GetAppsFlyerUID
앱스플라이어의 고유 기기 ID를 가져옵니다. SDK는 앱 설치 시 앱스플라이어의 고유 기기 ID를 생성합니다. SDK가 시작되면 이 ID가 첫 번째 앱 인스톨의 ID로 기록됩니다.
Method signature
string GetAppsFlyerUID()
Usage:
AppsflyerSteamModule afm = new AppsflyerSteamModule(DEV_KEY, STEAM_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:
AppsflyerSteamModule afm = new AppsflyerSteamModule(DEV_KEY, STEAM_APP_ID, this);
afm.SetCustomerUserId("15667737-366d-4994-ac8b-653fe6b2be4a");
afm.Start();
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);
샘플 앱 실행
- Unity 허브를 열고 프로젝트를 엽니다.
- Steamworks를 Unity 프로젝트에 추가합니다. Steamworks SDK 지침을 따라 패키지 관리자를 통해 추가합니다.
- 이
SteamScript.cs
의 샘플 코드를 사용하여 다음을 업데이트 합니다:DEV_KEY
andAPP_ID
. - 다음을
SteamManager
andSteamScript
를 빈 게임 개체에 추가합니다(또는 scenes 폴더에 있는 게임 개체 사용).
- Unity 편집기를 통해 샘플 앱을 실행하고 디버그 로그에 다음 메시지가 표시되는지 확인합니다.
- 24시간 후 대시보드가 업데이트되고 오가닉 및 논오가닉 인스톨과 인앱이벤트가 표시됩니다.
Steam 게임에서 앱스플라이어 구현하기
- Steamworks를 Unity 프로젝트에 추가합니다. Steamworks SDK 지침을 따라 패키지 관리자를 통해 추가합니다.
- Add
SteamManager.cs
를 게임 개체로 설정합니다. - 스크립트를
Assets/Scenes/AppsflyerSteamModule.cs
에서 앱으로 추가합니다. - 이
Assets/Scenes/SteamScript.cs
의 샘플 코드를 사용하여 다음을 업데이트 합니다:DEV_KEY
andAPP_ID
. - SDK 초기화.
AppsflyerSteamModule afm = new AppsflyerSteamModule(DEV_KEY, STEAM_APP_ID, this);
스팀 클라우드 저장 삭제(어트리뷰션 재설정)
- 스팀 클라우드 비활성화.
- 로컬 파일 삭제.
- Delete the PlayerPrefs data the registry/preferences folder, or use PlayerPrefs.DeleteAll() when testing the attribution in the UnityEditor.
최신 데이터 24일 전