Delete OneSignal tags from user profile

If you would like to remove tags from a user profile in OneSignal you can call the nativeFunctions.onesignalDeleteTags() function.

When a user opts out of notifications for promotional content, for example, you can call the nativeFunctions.onesignalDeleteTags() function, as follows:

<script type="text/javascript">
    // Get the user agent and convert it to lowercase for case-insensitive comparison
    var userAgent = navigator.userAgent.toLowerCase();

    // Remove a tag directly if the user agent contains 'canvas'
    function removeTag() {
        try {
            // Check if the user agent contains the string "canvas"
            if (userAgent.indexOf('canvas') > -1) {
                nativeFunctions.onesignalDeleteTags("promotions");
            }
        } catch (ex) {
            console.log(ex.message);
        }
    }
</script>

Note that you can also delete multiple tags at once, using nativeFunctions.onesignalDeleteTags(“tag1”, “tag2”, “tag3”)

Thank you! We'll be in touch within 48 hours :)
Oops! Something went wrong while submitting the form.