API Reference¶
Airlock's programmatic surface is intentionally tiny — register the extension once at app launch, then everything else is driven by Adobe Launch configuration and rule scripts. This page covers the small set of contracts developers and consultants need to know about.
SDK registration¶
iOS (Swift)¶
import AEPCore
import Airlock
MobileCore.registerExtensions([
Identity.self,
Lifecycle.self,
Analytics.self,
Airlock.self, // <-- here
]) {
MobileCore.configureWith(appId: "<your-launch-app-id>")
}
Airlock.self is the only symbol you import from the Airlock module. Conforms to AEPCore.Extension; the runtime handles everything else.
Android (Kotlin)¶
import com.adobe.marketing.mobile.MobileCore
import com.maxisdigital.airlock.Airlock
MobileCore.registerExtensions(
listOf(
Identity.EXTENSION,
Lifecycle.EXTENSION,
Analytics.EXTENSION,
Airlock.EXTENSION, // <-- here
)
) {
MobileCore.configureWithAppID("<your-launch-app-id>")
}
Airlock.EXTENSION is the Class<out Extension> reference for registration.
Public symbols¶
| Platform | Symbol | Type | Notes |
|---|---|---|---|
| iOS | Airlock |
public class conforming to AEPCore.Extension |
Pass Airlock.self to registerExtensions |
| iOS | Airlock.extensionVersion |
public static let String |
Current version, e.g. "0.3.16" |
| Android | Airlock |
Extension subclass |
Don't instantiate directly |
| Android | Airlock.EXTENSION |
@JvmField Class<out Extension> |
Pass to registerExtensions |
| Android | Airlock.EXTENSION_VERSION |
const val String |
Current version, e.g. "0.3.16" |
That's the entire developer-facing API. Everything else lives in the Launch UI or in JavaScript rule scripts.
Reserved contextdata keys¶
Airlock writes specific keys into every dispatched event's contextdata. Macros, lookup tables, derived metrics, and rule scripts must not use these names — collisions are either silently overwritten or, in the wire-format cases, actively dangerous.
| Key | Written by | Purpose |
|---|---|---|
airlock |
Airlock dispatcher | Extension version string (e.g. "0.3.16") |
airlock_type |
Airlock dispatcher | "trackAction" or "trackState" — the source event type |
airlock.status |
Airlock dispatcher | "ok" for normal, "error" for fail-open passthrough |
airlock.error |
Airlock dispatcher | Error message, only present when airlock.status == "error" |
&&events |
Set Serialized Events action; Build Product String action (auto-add) | Adobe Analytics events wire format |
&&products |
Build Product String action | Adobe Analytics products wire format |
Derived metric names that collide with this list are rejected at resolution time.
Shared state Airlock publishes¶
Airlock publishes its own shared state under the key airlock (lowercased, space-stripped friendly name), making computed values available to other Launch rules and JavaScript scripts. Inside a rule script: sharedState.airlock.<name>.
| Key shape | Source | Example |
|---|---|---|
sharedState.airlock.<macro_name> |
A configured macro | sharedState.airlock.userTier |
sharedState.airlock.<lookup_table_name> |
A lookup table data element | sharedState.airlock.categoryGroup |
sharedState.airlock.<accumulator_name> |
An accumulator | sharedState.airlock.purchaseCount |
sharedState.airlock.<derived_metric_name> |
A derived metric | sharedState.airlock.cartScore |
Macro results are computed once at config-load; lookup table, accumulator, and derived metric values are recomputed per event before the rule script runs.
JavaScript runtime contract¶
What's available inside evaluate-rules, macros, lookup tables, and derived metric scripts.
Globals¶
| Symbol | In macros | In rule scripts / derived metrics | Notes |
|---|---|---|---|
event |
✗ | ✓ | Full track event payload (action/state, contextdata, etc.) |
sharedState |
✓ | ✓ | Snapshot of all extension shared states, keyed by friendly name (lowercased, space-stripped) |
serializeEvent(name, serialID?, value?) |
✓ | ✓ | Builds an &&events entry. See Set Serialized Events |
buildProductString(opts) |
✓ | ✓ | Builds an &&products entry. See Product String Builder |
Engine differences¶
See JavaScript Engines for the full side-by-side breakdown including language support, runaway protection, sandbox mechanisms, and cross-platform gotchas.
| Feature | iOS | Android |
|---|---|---|
| JavaScript engine | JavaScriptCore (built-in) | Mozilla Rhino 1.9.1 (interpreted mode) |
| Runaway protection | 2-second wall-clock timeout | 100,000-instruction limit |
| Frozen prototypes | All standard prototypes | All except Date.prototype and RegExp.prototype (Rhino mutates them internally) |
| Host access | Blocked by JSC isolation | Blocked by ClassShutter { false } |
| Timer globals | setTimeout/setInterval/setImmediate set to undefined |
Not injected by Rhino in the first place |
Both engines guarantee:
- No filesystem, network, or process access from a rule script.
- Standard ES5 + most ES6 syntax. Avoid
async/awaitand modules. - Numbers are double-precision floats. Integer-shaped values stringify as
"42"(not"42.0").
Return value semantics¶
| Script type | What you return | What happens |
|---|---|---|
evaluate-rules |
Object | Dispatched as Airlock Processed Track event |
evaluate-rules |
null / undefined |
Event suppressed |
| Macro | Any value | Stored at sharedState.airlock.<name> |
| Lookup table cell | String | Used as the resolved value |
| Derived metric | Any value | Written to event.contextdata[<name>] and sharedState.airlock.<name> |
Versioning¶
Both platforms ship under a synchronised version string. iOS Airlock.extensionVersion and Android Airlock.EXTENSION_VERSION are guaranteed to match the Launch extension package version in use. Mismatches are a bug — please open an issue.