Action Configuration
In the view.json, one may define actions that will be executed based on what users do in the application.
Utilizing an action executor or a tap action, different actions may be triggered. Find a list and options below.
Each action type has specific properties that can be configured to customize behavior in your application. You can set them up in the views.jsons.
Navigate Action
Navigates users to another view within the storefront.
Properties
- type string required
- Value: "navigate"
- path string optional
- Path to navigate to (ignored if url is set)
- url string optional
- Complete URL to navigate to
- params object optional
- URL parameters to include
- mergeParams boolean optional
- Whether to merge with existing URL parameters
- replaceUrl boolean optional
- Whether to replace the current URL in browser history
- statusCode number optional
- HTTP status code (only affects server-side rendering)
Example
{
"type": "navigate",
"path": "/articles",
"params": {
"category": "news"
},
"replaceUrl": false
}Open Content Action
Opens Purple content issues, articles, or bundles.
Properties
- type string required
- Value: "openContent"
- fallback EventActionConfig optional
- Action to perform if content cannot be accessed
- limit number optional
- Maximum number of issues to include in pager
- pageIndex number optional
- Page index to open the initial issue on
- elementAlias string optional
- Element alias to jump to in the initial issue
- issueId string optional
- Specific issue ID to open
- bundle object optional
- Bundle configuration
- bundleId string required - ID of the bundle to open
- postId string optional - Specific post ID within the bundle
- pathPrefix string optional - Path pattern for the view that displays a bundle
- openCollection object optional
- Collection display configuration (deprecated)
- taxonomyId string optional
- Taxonomy ID for dynamic URL generation
- taxonomyType string optional
- Taxonomy type for dynamic URL generation
- titleBar boolean optional
- Whether to show the native title bar
Example
{
"type": "openContent",
"issueId": "article-123",
"titleBar": true,
"limit": 10,
"pageIndex": 1
}Popup Action
Opens a storefront view as a popup overlay.
Properties
- type string required
- Value: "popup"
- path string required
- Path to the view to open in popup
- params object optional
- Parameters to pass to the popup view
- animation string optional
- Animation type: "SLIDE_IN" or "POP_UP"
Example
{
"type": "popup",
"path": "/subscription-details",
"animation": "SLIDE_IN",
"params": {
"planId": "premium"
}
}Login Action
Opens the login view for user authentication.
Properties
- type string required
- Value: "login"
- params object optional
- Parameters to pass to the login view
- replaceUrl boolean optional
- Whether to replace the current URL
Example
{
"type": "login",
"params": {
"returnUrl": "/premium-content"
},
"replaceUrl": false
}Logout Action
Logs out the current user.
Properties
- type string required
- Value:"logout"
- confirm boolean optional
- Whether to show a confirmation dialog
Example
{
"type": "logout",
"confirm": true
}External Login Action
Performs authentication through an external service.
Properties
- type string required
- Value: "externalLogin"
- url string required
- URL of the external login service
- params object optional
- Additional parameters for the URL
- callbackParamName string optional
- Name of callback parameter
- Default: "callbackurl"
- assignLocalPurchases string optional
- How to handle local purchases during login
- accountIdParamName string optional
- Parameter name for account ID
- Default: "userId"
- entitlementParamNames object optional
- Entitlement login configuration
- usernameKey string - Username parameter key (default: "username")
- passwordKey string - Password parameter key (default: "password")
- accountIdFromEntitlement boolean - Use account ID from entitlement token
- onSuccess EventActionConfig required
- Action to perform after successful login
- onCancel EventActionConfig optional
- Action to perform if login is cancelled
- onStart EventActionConfig optional
- Action to perform when login starts
- closeOnModalCancel boolean optional
- Whether to close modal on cancel
Example
{
"type": "externalLogin",
"url": "https://auth.example.com/login",
"callbackParamName": "callback",
"onSuccess": {
"type": "navigate",
"path": "/dashboard"
}
}Register Action
Opens the user registration view.
Properties
- type string required
- Value: "register"
- params object optional
- Parameters to pass to the registration view
Example
{
"type": "register",
"params": {
"plan": "premium"
}
}Open URL Action
Opens an external URL in a browser or specified target.
Properties
- type string required
- Value: "openUrl"
- url string required
- URL to open
- target string optional
- Target window/tab (e.g., "_blank", "_self")
- params object optional
- Additional parameters
Example
{
"type": "openUrl",
"url": "https://support.example.com",
"target": "_blank"
}Purchase Action
Initiates a one-time purchase of a product.
Properties
- type string required
- Value: "purchase"
- productId string required
- ID of the product to purchase
- price number required
- Price of the product
- currency string required
- Currency code (e.g., "USD", "EUR")
- showErrorDialog boolean optional
- Show error dialog on failure
- Default: true
- onSuccess EventActionConfig optional
- Action to perform after successful purchase
- consumeOptions object optional
- Options for repeatable purchases
Example
{
"type": "purchase",
"productId": "article-unlock-123",
"price": 2.99,
"currency": "USD",
"showErrorDialog": true,
"onSuccess": {
"type": "openContent",
"issueId": "article-123"
}
}Subscribe Action
Initiates a subscription to a recurring product.
Properties
- type string required
- Value: "subscribe"
- productId string required
- ID of the subscription product
- price number required
- Price of the subscription
- currency string required
- Currency code
- showErrorDialog boolean optional
- Show error dialog on failure
- Default: true
- onSuccess EventActionConfig optional
- Action after successful subscription
- upgradeMode string optional
- Upgrade behavior:
- "IMMEDIATE_WITH_TIME_PRORATION" - Immediate upgrade with time-based proration
- "IMMEDIATE_AND_CHARGE_PRORATED_PRICE" - Immediate upgrade, charge price difference
- "IMMEDIATE_WITHOUT_PRORATION" - Immediate upgrade, no proration
- "DEFERRED" - Upgrade only when subscription renews
- offerId string optional
- Promotional offer ID (iOS only)
Example
{
"type": "subscribe",
"productId": "premium-monthly",
"price": 9.99,
"currency": "USD",
"upgradeMode": "IMMEDIATE_WITH_TIME_PRORATION",
"onSuccess": {
"type": "navigate",
"path": "/premium-dashboard"
}
}Restore Purchases Action
Restores previously purchased items (iOS only).
Properties
- type string required
- Value: "restorePurchases"
- onSuccess EventActionConfig optional
- Action to perform after restoration
- confirm boolean | string optional
- Show confirmation dialog or custom message
Example
{
"type": "restorePurchases",
"confirm": "Are you sure you want to restore your purchases?",
"onSuccess": {
"type": "navigate",
"path": "/my-content"
}
}Subscriptions Action
Opens the subscriptions management view.
Properties
- type string required
- Value: "subscriptions"
- params object optional
- Parameters to pass to the subscriptions view
Example
{
"type": "subscriptions",
"params": {
"tab": "active"
}
}Coupon Action
Opens the coupon redemption view.
Properties
- type string required
- Value: "coupon"
- params object optional
- Parameters to pass to the coupon view
Example
{
"type": "coupon",
"params": {
"prefilledCode": "WELCOME2024"
}
}Set User Attribute Action
Sets a custom attribute for the current user.It can be accessed through : $context.userAttributes
Properties
- type string required
- Value: "setUserAttribute"
- key string required
- Attribute key/name
- value string required
- Attribute value
- onFinished EventActionConfig optional
- Action to perform after setting the attribute
Example
{
"type": "setUserAttribute",
"key": "preferred_language",
"value": "en",
"onFinished": {
"type": "navigate",
"path": "/personalized-content"
}
}Delete All Bookmarks Action
Removes all user bookmarks.
Properties
- type string required
- Value: "deleteAllBookmarks"
- confirm boolean optional
- Whether to show confirmation dialog
Example
{
"type": "deleteAllBookmarks",
"confirm": true
}Set Context Variables Action
Sets context variables that can be used throughout the application.It can be accessed through $context['key'] where key represent the key of the variable
Properties
- type string required
- Value: "setContextVariables"
- variables array required
- Array of variable objects
- Each object contains:
- key string required - Variable name
- value string required - Variable value
Example
{
"type": "setContextVariables",
"variables": [
{
"key": "theme",
"value": "dark"
},
{
"key": "region",
"value": "europe"
}
]
}Multi Action
Executes multiple event actions in sequence.
IMPORTANT: Actions must not rely on each other! IMPORTANT: Actions must not use context information being changed in one of the actions. Each action in the sequence executes independently and should not depend on the results or side effects of previous actions in the same multi-action configuration. Use Cases: - Store user data, then navigate to a new page - Set user preferences, then open content - Log analytics events, then perform navigation
Properties
- type string required
- Value: "multiAction"
actions array required
- List of actions to execute in sequence
- Array of EventActionConfig objects
Example
{
"type": "multiAction",
"actions": [
{
"type": "setUserAttribute",
"key": "last_viewed",
"value": "premium-content"
},
{
"type": "openContent",
"issueId": "article-123"
},
{
"type": "navigate",
"path": "/reading-history"
}
]
}Remarks
Configuration Patterns
Action Chaining
Many actions support callback properties that allow chaining actions together:
- onSuccess - Execute after successful completion
- onFinished - Execute after any completion
- onCancel - Execute if action is cancelled
{
"type": "purchase",
"productId": "premium-article",
"price": 1.99,
"currency": "USD",
"onSuccess": {
"type": "openContent",
"issueId": "premium-article-123"
}
}Conditional Values
Some properties support conditional values that change based on application state or user properties. These require developer configuration.
Parameters Usage
The params object allows passing additional data:
- Navigation parameters for URL generation
- View-specific configuration options
- Form pre-population data
Best Practices
- Testing - Always test configurations in development before production
- User Experience - Use confirmation dialogs judiciously for destructive actions
- Pricing - Ensure currency and pricing match app store configuration
- URLs - Verify all paths work correctly in your application setup
- Product IDs - Must match configured in-app purchases exactly