Skip to main content

Integrate with sandbox (legacy)

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 selectPlacements function.

Warning

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

Overlay placement exampleDirect link to 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 sample code from the adding an overlay placement documentation to include the following:

import Rokt_Widget

class OrderConfirmationViewController: UIViewController {
...
// call this function when the placement needs to be shown
func showWidget() {
let attributes = ["email": "j.smith@example.com",
"sandbox": "true",
"firstname": "Jenny",
"lastname": "Smith",
"mobile": "(555)867-5309",
"postcode": "90210",
"country": "US"]

Rokt.selectPlacements(identifier: "RoktExperience", attributes: attributes, onEvent: { roktEvent in
// Handle Rokt events
})
}
}

Embedded placement exampleDirect link to 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 the following:

import Rokt_Widget
class OrderConfirmationViewController: UIViewController {

// linked to RoktEmbeddedView created in step 5 or it could be created programmatically
@IBOutlet weak var roktEmbeddedView: RoktEmbeddedView!

...

// call this function when placement needs to be shown
func showWidget() {
let attributes = ["email": "j.smith@example.com",
"sandbox": "true",
"firstname": "Jenny",
"lastname": "Smith",
"mobile": "(555)867-5309",
"postcode": "90210",
"country": "US"]

let placements: [String : RoktEmbeddedView] = ["RoktEmbedded1": roktEmbeddedView]

Rokt.selectPlacements(identifier: "RoktEmbeddedExperience", attributes: attributes, placements: placements, onEvent: { roktEvent in
// Handle Rokt events
})
}
}
Was this article helpful?