メインコンテンツまでスキップ

サンドボックスとの統合 (レガシー)

サンドボックス統合を使用すると、サンドボックス環境に対してテストするための設定フラグを含めることができます。サンドボックス環境は、通常のオファー、入札、マッチングプロセスを本番環境の設定に対して行います。サンドボックス環境はRoktの本番環境の一部ですが、広告主に料金を請求したり収益を生成したりしません。そのため、本番環境にデプロイする前の受け入れテストに使用できます。

統合は前の例とまったく同じ手順に従いますが、execute 関数に追加の sandbox 属性が必要です。

警告

プレースメントを本番環境で稼働させる前に、sandbox 属性を削除する必要があります。

オーバーレイプレースメントの例

サンドボックス環境でオーバーレイプレースメントを実行するには、Roktに渡す属性のリストを "sandbox": "true" を含むように更新する必要があります。これは、オーバーレイプレースメントの追加 ドキュメントの例からコードを更新して、以下を含めることで実行できます:

import com.rokt.roktsdk.Rokt;

class ConfirmationActivity : Activity() {
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
...

Map<String,String> attributes = new HashMap<String, String>();

attributes.put("email", "j.smith@example.com");
attributes.put("sandbox", "true");
attributes.put("firstname", "Jenny");
attributes.put("lastname", "Smith");
attributes.put("mobile", "(323) 867-5309");
attributes.put("postcode", "90210");
attributes.put("country", "US");

Rokt.INSTANCE.execute("RoktExperience",
attributes,
new Rokt.RoktCallback() {
@Override
public void onLoad() {
}
@Override
public void onUnload(Rokt.UnloadReasons unloadReasons) {
}
@Override
public void onShouldHideLoadingIndicator() {
}
@Override
public void onShouldShowLoadingIndicator() {
}
}
)
...
}
}

埋め込みプレースメントの例

サンドボックス環境で埋め込みプレースメントを実行するには、Roktに渡される属性リストを更新して "sandbox": "true" を含める必要があります。これは、埋め込みプレースメントの追加 ドキュメントのサンプルコードを以下のように更新することで実行できます:

import com.rokt.roktsdk.Widget;
import com.rokt.roktsdk.Rokt;

class ConfirmationActivity : Activity() {

private Rokt.RoktCallback roktCallback = new Rokt.RoktCallback() {
@Override
public void onLoad() {
}

```java
@Override
public void onShouldShowLoadingIndicator() {
}

@Override
public void onShouldHideLoadingIndicator() {
}

@Override
public void onUnload(@NotNull Rokt.UnloadReasons unloadReasons) {
}
};

override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
...

Map<String, String> attributes = new HashMap<String, String>();

attributes.put("email", "j.smith@example.com");
attributes.put("sandbox", "true");
attributes.put("firstname", "Jenny");
attributes.put("lastname", "Smith");
attributes.put("mobile", "(323) 867-5309");
attributes.put("postcode", "90210");
attributes.put("country", "US");

// ウィジェットプレースホルダがプレースホルダビューと配置場所の設定をマッピング
Widget widget = findViewById(R.id.roktWidget);
Map<String, WeakReference<Widget>> placeHolders = new HashMap<>();
placeHolders.put("RoktEmbedded1", new WeakReference<>(widget));

Rokt.INSTANCE.execute("RoktExperience",
attributes,
roktCallback,
placeHolders);
...
}
この記事は役に立ちましたか?