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">
// Add the event listener
window.addEventListener("message", (event) => {
isAppReady = event;
}, false);
// Log the user in
function removeTag(isAppReady) {
try {
// Check if the native functions are ready to be used
if (isAppReady.data && isAppReady.data == 'nativeFunctionsLoaded') {
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")