Skip to main content

Integrate with sandbox

With a sandbox integration, you can include a configuration flag to test against a sandbox environment. The sandbox environment follows a normal offers, bidding, and matching process against your production configuration. While a sandbox environment is part of the Rokt production environment, it does not charge advertisers or generate revenue. As a result, you can use it for acceptance testing before deploying to production.

The integration follows exactly the same steps as in previous examples, with an additional sandbox attribute required in the execute function.

Warning

You must remove the sandbox attribute before going live with your placement.

Overlay placement example

To run an overlay placement in the sandbox environment, the list of attributes passed to Rokt needs to be updated to include "sandbox": "true". This can be done by updating the code from the example in the adding an overlay placement documentation to include the following:

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() {
}
}
)
...
}
}

Embedded placement example

To run an embedded placement in the sandbox environment, you need to update the list of attributes passed to Rokt to include "sandbox": "true". This can be done by updating the sample code from the adding an embedded placement documentation to include the following:

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

class ConfirmationActivity : Activity() {

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

@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 placeholder mapping the placeholder view with placement location configuration
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);
...
}
}
Was this article helpful?