Skip to main content

Reveal component methods

caution

The following breaking changes will be made on Oct 26, 2022. Please check if you are using the following deprecated calls and change them to the new format:

// Deprecated
revealComponentSelectOutcome('reveal_123', { outcomeName: 'Outcome 1'});
revealComponentSelectOutcome('reveal_123', 'Outcome 1');
// Deprecated
revealComponentResetOutcome('reveal_123');
revealComponentResetParticipation('reveal_123');
ActionMethodParametersExampleNotes
Lock componentrevealComponentLock* componentId - StringrevealComponentLock('reveal_123')Lock Pre-Reveal content so user cannot participate. Use this to gate or limit participation based on some custom logic.
Unlock componentrevealComponentUnlock* componentId - StringrevealComponentUnlock('reveal_123')Unlock Pre-Reveal content so user can start to participate. Use this to gate or limit participation based on some custom logic.
Select specific outcomerevealComponentSelectOutcome* componentId - String, outcomeName - StringrevealComponentSelectOutcome('reveal_123', 'Outcome 1')If the Outcome selection mode is "random", outcomeName is not required, and ignored if present. If the Outcome selection mode is "custom", outcomeName is required.
Get selected outcome inforevealComponentGetOutcome* componentId - StringrevealComponentGetOutcome('reveal_123')Access information about the outcome displayed to the user
Start participationrevealComponentStartParticipation* componentId - String, options - ObjectrevealComponentStartParticipation('reveal_123', {'outcomeName': 'Outcome 1'})Can be called only when a component is unlocked. This will change the component state to 'IN_PROGRESS' and send the relevant SDK and metrics events. Can be used for starting participation via SDK when you are using Custom Pre-Reveal or Spin-to-Win.
Stop participationrevealComponentStopParticipation* componentId - StringrevealComponentStopParticipation('reveal_123')Use this method to stop participation phase and display an outcome via SDK. This will change the component state to 'STOPPED', send the relevant SDK and metrics events, display an outcome, and update the participation state in Local Storage. This can be called for any Pre-Reveal type.
Reset participationrevealComponentResetParticipation* componentId - StringrevealComponentResetParticipation('reveal_123')Use this method to reset outcome and participation state in Local Storage to allow a user participate again.
Spin wheel and show outcomerevealComponentSpinWheelAndStop* componentId - String, options - Object, options.duration - Number, speed - NumberrevealComponentSpinWheelAndStop('reveal_123', { speed: 3, duration: 5000 })This is an alias wrapping revealComponentStartParticipation for convenience when using Spin-to-Win Pre-Reveal.
Check if component is lockedrevealComponentIsLocked* componentId - StringrevealComponentIsLocked('reveal_123')Check lock/unlock status of Pre-Reveal