Google Play 설치 리퍼러

게임의 가장 가치 있는 사용자 획득 채널을 파악하여 정보에 기반한 마케팅 결정을 내리세요. Google Play Install Referrer API를 사용하여 앱의 추천 정보를 안정적으로 추적할 수 있습니다.

리퍼러 데이터를 추적하면 어떤 트래픽 소스를 통해 사용자가 Google Play 스토어에서 앱을 다운로드하는지 파악할 수 있습니다. 이러한 통계를 통해 광고비를 최대한 활용하고 ROI를 극대화할 수 있습니다.

네임스페이스: PlayPcSdkManaged.InstallReferrer

클라이언트 클래스: InstallReferrerClient

스토어 등록정보 페이지 링크

먼저 사용자를 애플리케이션의 Google Play 스토어 페이지로 연결합니다. URL에 다음 쿼리 매개변수를 포함합니다.

  • id: 게임의 Play 패키지 이름
  • referrer: 추천 소스를 나타내는 문자열입니다. 이 문자열은 애플리케이션이 설치되고 실행된 후 쿼리할 수 있습니다.
https://play.google.com/store/apps/details?id=com.example.package&referrer=example_referrer_source

클라이언트 만들기

항상 팩토리를 사용하여 InstallReferrerClient를 만드세요. 이렇게 하면 Unity에서 안전한 콜백이 자동으로 등록됩니다.

using UnityEngine;
using System;
using System.Threading.Tasks;
// Required SDK Namespaces
using PlayPcSdkManaged.InstallReferrer;
using PlayPcSdkManaged.Unity;

public class InstallReferrerManager : MonoBehaviour
{
    private InstallReferrerClient _installReferrerClient;

    public void SetupInstallReferrer()
    {
        try
        {
            // Creates the client with the required UnityInstallReferrerCallbacksHandler
            _installReferrerClient = PlayPcSdkFactory.CreateInstallReferrerClient();
            Debug.Log("Install Referrer Client created successfully.");
        }
        catch (Exception ex)
        {
            Debug.LogError($"Failed to create Install Referrer Client: {ex.Message}");
        }
    }

    private void OnDestroy()
    {
        // Always dispose of the client to clean up native C++ resources
        _installReferrerClient?.Dispose();
    }
}

설치 리퍼러 쿼리

사용자가 게임을 설치하고 실행하면 앱은 설치 리퍼러 API를 사용하여 설치를 유도한 트래픽 소스를 확인할 수 있습니다.

GetInstallReferrerAsync를 사용하여 리퍼러 세부정보를 쿼리합니다. 응답에는 스토어 등록정보 페이지의 referrer 쿼리 매개변수에 전달된 것과 동일한 문자열이 포함됩니다.

public async Task GetInstallReferrerAsync()
{
    try
    {
        Debug.Log("Querying Install Referrer...");

        // Async call to retrieve referral information
        var result = await _installReferrerClient.GetInstallReferrerAsync();

        if (result.IsOk)
        {
            // On success, access the InstallReferrer and InstallTimeEpochSeconds
            var referrer = result.Value.InstallReferrer;
            var installTime = result.Value.InstallTimeEpochSeconds;

            Debug.Log($"Install Referrer: {referrer}");
            Debug.Log($"Install Time: {installTime}");

            // Attribute your game's installation to an acquisition channel
        }
        else
        {
            // Handle expected API errors (e.g., Error)
            Debug.LogError($"Query Failed: {result.Code} - {result.ErrorMessage}");
        }
    }
    catch (Exception ex)
    {
        Debug.LogException(ex);
    }
}