Roku (Brighscript)

GitHubレポジトリへのリンク

AppsFlyer Roku SDK integration

AppsFlyerは、クロスプラットフォームアトリビューション、モバイルおよびウェブ分析、ディープリンク、不正検出、プライバシー管理と保全など、実際のペインポイントを解決する強力なツールを提供することで、ゲームマーケティング担当者がより良い意思決定を行えるように支援します。

ゲームのアトリビューションには、ゲームがHTTPSでAppsFlyerのAPIと通信し、初回起動、連続セッション、アプリ内イベントなどのユーザーアクティビティをレポートすることが必要です。(例:購入など)
AppsFlyer SDKをRoku channelに組み込む際の参考として、このサンプルアプリを使用することをお勧めします。


AppsFlyerRokuSDK - Interface

AppsFlyerRokuSDK.brs, included in the source/appsflyer-integration-files folder, contains the required code and logic to connect to AppsFlyer servers and report events.

Start

このメソッドは、APIキーとアプリIDを受け取り、AppsFlyerに初回起動とセッションのリクエストを送信するAppsFlyer Moduleを初期化します。

メソッドのシグネチャ

AppsFlyer().start(<< DEV_KEY >>, << APP_ID >>)

例:

' Initialize the AppsFlyer integration (send first-open/session event)
AppsFlyer().start(<< DEV_KEY >>, << APP_ID >>)

Arguments:

LogEvent

このメソッドは、イベント名とJSONオブジェクトを受け取り、アプリ内イベントをAppsFlyerに送信します。

メソッドのシグネチャ

AppsFlyer().logEvent(eventName, trackEventValues)

例:

trackEventValues = CreateObject("roAssociativeArray")
trackEventValues = {"af_revenue": 24.22, "af_currency":"ILS", "freeHandParam": "freeHandValue"}

AppsFlyer().logEvent("af_purchase", trackEventValues)

サンプルアプリの実行

  1. Open the appsflyer-sample-app folder in VSCode.
  2. In source/main.brs, replace the following parameters with your own:
devkey = << DEV_KEY >>
appid = << APP_ID >>
  1. Deploy the channel. (Using this plugin makes it easier)

  2. After the app loads:

    1. Click OK to see the start event details.
    2. Click the options button (*) and then OK to see the logEvent.

Implementing AppsFlyer in your Roku channel

Setup

  1. Copy the files from the appsflyer-integration-files folder into your project.
  2. Add the following code to your main.brs file and Initialize the AppsFlyer integration:
Function Main(args as Dynamic) as Void
    ...
    showAppsflyerChannelSGScreen(args)
    ...
End Function

sub showAppsflyerChannelSGScreen(args as Dynamic)
    screen = CreateObject("roSGScreen")
    m.port = CreateObject("roMessagePort")
    screen.setMessagePort(m.port)
    scene = screen.CreateScene("AppsFlyerScene")
    screen.show()

    ' Initialize the AppsFlyer integration (send first-open/session event)
    AppsFlyer().start(DEV_KEY, APP_ID)
    ' Enable debugging if necessary
    AppsFlyer().enableDebugLogs(true) ' same as AppsFlyer().setLogLevel("debug")

    if args.Lookup("contentId") <> invalid then
        AppsFlyer().trackDeeplink(args)
    else
        AppsFlyer().trackAppLaunch()
    endif

    ' ConversionData response arrives here
    while true
        msg = Wait(0, m.port)
        ?"MESSAGE RECEIVED: "msg.GetData()
        msgType = Type(msg)
        if msgType = "roSGScreenEvent"
            if msg.isScreenClosed() then
                return
            end if
        end if
    end while
end sub
  1. Report in-app events.