Skip to main content

Image. Shows the flow of using Click Actions to form Location and Push prompts for iOS

Click actions

Click Actions are specific events that can be added to in-app messages to make them more interactive. They can be added to blocks when using the drag-and-drop editor or to any element in the HTML editor (see In-app JavaScript API). Click actions include the following abilities:

URL

Leaves the app and opens the default browser to the URL you specify. Maps to the openUrl method when using the In-App JS Library.

Push permission prompt

Shows the native iOS or Android Push Permission Prompt.
  • If the iOS or Android device is currently subscribed, the In-App Message will not show.
  • If the iOS or Android device is currently unsubscribed and has been prompted previously, it will show a native alert asking the user to enable push notifications in the app settings.
Maps to the triggerPushPrompt method when using the In-App JS Library.

Location permission prompt

Shows the native operating system prompt to ask permission for location tracking. Requires location tracking permissions to be added to your app. See Location Opt-In Prompt for details on setup. Maps to the triggerLocationPrompt method when using the In-App JS Library.

Send Outcome

Tracks user interaction for analytics purposes. Outcomes sent through In-App messages will show as “Unattributed” Outcomes and will set a Tag on the user in format outcome name : true. See Custom Outcomes for more details. Maps to the sendOutcome method when using the In-App JS Library.

Tag user

Adds a Tag to the user to express interest and later segment into another group based on user response to send more targeted messaging. Maps to the tagUser method when using the In-App JS Library.

Custom Action ID

Pass a custom value that, when clicked, can be read within the app using the OneSignal SDK IAM Click Listener method Used for custom action handling like: Maps to the addClickName method when using the In-App JS Library.

How to collect custom click actions

When an Image or Button block is clicked, you can use the Custom Action ID and set a value to identify that block was clicked. This Action ID can then be detected through the OneSignal SDK IAM Click Listener method and that data can be sent to your server/date base/analytics vendor.

Example: create a poll

If you want to survey your users with a multiple choice questionnaire and then display their choices within the app. You can setup the Action ID per button to be a unique identifier for that option. Whenever that option is clicked, it will be detected in the OneSignal SDK IAM Click Listener method. From there, you can make an API request to your server to store that data and access it within the app later to display to your users.

See Deep Linking for details.

How to create a rating action

There are several ways to get reviews from your users. The simplest way is to use the URL click action to deep link directly to the App Store. You can also trigger native APIs via the Action ID to display the review prompt directly in the app. More details, see Example: Ask for App Store Rating.
I