You can build this logic by using custom HTML, JavaScript, and user tags within your Customer Journey.
1. Add the checkbox to your HTML
Include a standard checkbox element in your in-app (Rich Media) template code. Give it a clear ID so your script can find it.
2. Set a tag with JavaScript
Add an event listener to the button that closes your message. When a user clicks it, the script checks if they selected the checkbox. If they did, it sends a tag to the Pushwoosh SDK. The SDK provides the pushwoosh object automatically, so you do not need to import anything else.
document.getElementById('close-button').addEventListener('click', function() {
if (document.getElementById('no-show-checkbox').checked) {
pushwoosh.sendTags({ 'dismissed_popup': true });
}
pushwoosh.closeInApp();
});
3. Use segments to filter users
To stop the message from appearing again, you must exclude users who have the tag you created.
- For journeys with a Trigger-based entry: place a Condition split element (previously called Segment split) immediately after the entry element. Configure it so that only users whose
dismissed_popuptag is nottruecontinue to the in-app branch. - For journeys with an Audience-based entry: edit the segment used in the entry element and add a filter that excludes any device where the
dismissed_popuptag is set totrue.
Note: sendTags, closeInApp, postEvent and getTags are the in-app JavaScript API methods exposed by the SDK.
Comments
0 comments
Please sign in to leave a comment.