Google Play のインストール リファラー

ゲームの最も価値の高いユーザー獲得チャネルを特定して、情報に基づいたマーケティング判断を行いましょう。Google Play Install Referrer API を使用すると、アプリのリファラー情報を確実にトラッキングできます。

リファラーデータをトラッキングすることで、Google Play ストアからアプリをダウンロードするユーザーを最も多く送り込んでいるトラフィック ソースを把握できます。こうした分析情報があれば、広告費用を最大限に活用して ROI を最大化できます。

Namespace: PlayPcSdkManaged.InstallReferrer

Client Class: InstallReferrerClient

ストアの掲載情報のページへのリンク

まず、ユーザーをアプリの Google Play ストアのページにリンクします。URL には、次のクエリ パラメータを含めます。

  • id: ゲームの Google Play パッケージ名
  • referrer: 参照ソースを表す文字列。この文字列は、アプリがインストールされて実行された後にクエリできます。
https://play.google.com/store/apps/details?id=com.example.package&referrer=example_referrer_source

クライアントを作成する

Factory を使用して 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();
    }
}

インストール リファラーをクエリする

ユーザーがゲームをインストールして起動すると、アプリは Install Referrer 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);
    }
}