Skip to content

Commit 3205fcc

Browse files
committed
docs: update rokt setup and migration guidance
Document explicit Rokt event subscriptions and iOS payment extension setup for shoppable ads in both README and migration notes.
1 parent f3c8eb6 commit 3205fcc

2 files changed

Lines changed: 54 additions & 2 deletions

File tree

MIGRATING.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -92,6 +92,6 @@ await MparticleFlutterSdk.getInstance().then((mp) => mp?.rokt.selectShoppableAds
9292
- **Android**: the method is exposed for API parity but is a no-op (logs a warning).
9393
- **Web**: not implemented — calls will throw `MissingPluginException`.
9494

95-
Events for a shoppable ads placement are delivered on the existing `MPRoktEvents` `EventChannel` once `selectShoppableAds` has been called.
95+
Rokt event delivery now uses explicit subscription by identifier through `Rokt.events(...)`. Call `events(identifier, ...)` before `selectPlacements(...)` or `selectShoppableAds(...)` for that identifier.
9696

97-
The Rokt Apple Pay payment extension (for example `RoktStripePaymentExtension`) is **not** proxied through Dart. Integrators must register it directly from native Swift/Objective-C in the host app (for example `ios/Runner/AppDelegate.swift`), after `MParticle.sharedInstance().start(with:)`. See the [Apple SDK Rokt integration section](https://github.com/mParticle/mparticle-apple-sdk/blob/main/README.md#rokt-integration) for the exact snippet.
97+
The Rokt payment extension (for example `RoktPaymentExtension`) is **not** proxied through Dart. Integrators must add the pod and register it directly from native Swift/Objective-C in the host app (for example `ios/Runner/AppDelegate.swift`), after `MParticle.sharedInstance().start(with:)`.

README.md

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -256,6 +256,58 @@ You must first call `getInstance` on `MparticleFlutterSdk` before each method is
256256
MparticleFlutterSdk? mpInstance = await MparticleFlutterSdk.getInstance();
257257
```
258258

259+
### Rokt
260+
261+
`Rokt` is exposed under `mpInstance?.rokt` and supports:
262+
263+
- `events(String identifier, void Function(dynamic event) onEvent)`
264+
- `selectPlacements(...)`
265+
- `selectShoppableAds(...)` (iOS implementation; Android no-op for parity; web unsupported)
266+
- `purchaseFinalized(...)` (iOS)
267+
268+
Subscribe to events for a placement identifier before selecting placements:
269+
270+
```dart
271+
mpInstance?.rokt.events('MSDKEmbeddedLayout', (event) {
272+
print('Rokt event: $event');
273+
});
274+
275+
await mpInstance?.rokt.selectPlacements(
276+
identifier: 'MSDKEmbeddedLayout',
277+
attributes: {'email': 'user@example.com'},
278+
);
279+
```
280+
281+
For iOS shoppable ads:
282+
283+
```dart
284+
mpInstance?.rokt.events('StgRoktShoppableAds', (event) {
285+
print('Rokt shoppable event: $event');
286+
});
287+
288+
await mpInstance?.rokt.selectShoppableAds(
289+
identifier: 'StgRoktShoppableAds',
290+
attributes: {'email': 'user@example.com'},
291+
);
292+
```
293+
294+
To enable iOS payment flows for shoppable ads, add the payment extension pod in your app `ios/Podfile` and register it natively after `MParticle.sharedInstance().start(with:)`:
295+
296+
```ruby
297+
pod 'RoktPaymentExtension'
298+
```
299+
300+
```swift
301+
import RoktPaymentExtension
302+
303+
if let paymentExtension = RoktPaymentExtension(
304+
applePayMerchantId: "merchant.com.example.app",
305+
urlScheme: nil
306+
) {
307+
MParticle.sharedInstance().rokt.registerPaymentExtension(paymentExtension)
308+
}
309+
```
310+
259311
### Custom Events
260312

261313
To log events, import mParticle `EventTypes` and `MPEvent` to write proper event logging calls:

0 commit comments

Comments
 (0)