Before you start
- Install the Encore SDK for your platform and call
configure(), as in its quickstart: iOS, Android, React Native, Flutter, or Web. - Identify your user with
identify()once you know who they are, as forshow(). - Pick a placement ID for each spot, such as
milestone_reachedfor the end of a streak andhomefor your home screen. A trigger component opens the same reward sheetshow()presents at that placement, so the placement works exactly as it does there.
Add a Gifts Button
Put it on the screen where you would otherwise callshow() for a reward, in place of that call:
Add a Claim Reminder
Put it on a screen users return to on their own, such as your home screen:Claim Reminder shows a claim the user started but hasn’t finished. Until the SDKs can read the user’s open claims from Encore, which ships after the first trigger release, it shows only claims made in your app on this device. Adding it now is safe: with no claim to show, it takes no space and sends nothing.
Use your own words (optional)
Set the entry’s text withheadline, subheadline and cta, as you do for the reward sheet. Leave any of them out and that line keeps the look’s own copy, in the user’s language:
Pay your prize (optional)
If your app pays its own prize for trying an offer, pass it aspublisherReward and read the result in onResult. See Pass your prize and read the result.
The trigger host
Each shorthand on this page is the trigger host with its ID built in. Use the host when your app places trigger components through one code path, for example from your own server-driven layout. It takes the trigger ID as a string:Parameters
The host and every shorthand take these by name. Every one exceptplacement (and id on the host) is optional.
The names of the typed values differ by platform:
On the web,
publisherReward, onResult and alignment go inside the options object you pass to mount(), and the handle’s setAlignment() moves a mounted trigger component.
Platform notes
- iOS. The SDK installs on iOS 15, but trigger components draw only on iOS 17 or later. Below that they render nothing.
EncoreTriggerView(UIKit) takespublisherRewardandonResultas properties you set after creating it;GiftsButtonView(placement:)andClaimReminderView(placement:)take them directly when you create them. Pin a UIKit view’s leading and trailing edges, not its height. - Android. Android 7.0 (API 24) or later.
EncoreTriggerView’s constructor doesn’t takepublisherReward,onResultoralignment; set them as properties. OnGiftsButtonViewandClaimReminderView,alignmentis a property too. OnEncoreTriggerViewthe ID property istriggerId, becauseView.idis already the view’s integer ID. XML attributes carry anencoreprefix:app:encoreTriggerId,app:encorePlacement,app:encoreUseCase,app:encoreIcon,app:encoreAlignment, andapp:encoreAutoOpen. Usewrap_contentfor the height. - React Native. React Native 0.72 or later. The trigger components render the native trigger view, so they need the native module linked: in Expo Go, or with React Native for web, they render nothing and log one warning. A
stylesets the width and margins; the height always comes from the trigger component. When you readonResult, checkresult.status === 'presented'before readingresult.claim. - Flutter. iOS 17 or later (the plugin installs on iOS 15), and Android API 26 or later. Android and iOS only: on the web and desktop the widgets render nothing. Give them a bounded width, as inside a
ColumnorListView. - Web.
mount()returns a handle; callunmount()when you remove the element. The React components clean up for you and render inside theEncoreProviderfrom React. If you serve the SDK’s ES module build yourself, serve the wholedist/esmfolder: trigger components load from itschunksfolder on first use, so a page without them never downloads them.
Next steps
- Gifts Button: what it shows and paying your prize.
- Claim Reminder: what it shows and when.
- Experiments and looks: how Encore picks and tests looks.
- Troubleshooting: why a trigger component isn’t showing.