How to use Canvas functions

Specific features of Canvas can be triggered manually through the use of Javascript functions.

These functions must be implemented directly on the website side, and will only work when the website is viewed inside the app.

Below you can find a list of all the available functions:

Adds an array of tags to the user profile in OneSignal

<button onclick="nativeFunctions.onesignalSendTags(['tag1', 'tag2', 'tag3'])">Add tags</button>

Removes an array of tags from the user profile in OneSignal

<button onclick="nativeFunctions.onesignalDeleteTags(['tag1', 'tag2', 'tag3'])">Remove tags</button>

Adds an external ID to the user profile in OneSignal

<button onclick="nativeFunctions.onesignalSetExternalUserId('123')">Add user ID</button>

Removes an external ID from the user profile in OneSignal

<button onclick="nativeFunctions.onesignalRemoveExternalUserId('123')">Remove user ID</button>

Adds an email profile to OneSignal

<button onclick="nativeFunctions.onesignalSetEmail('[email protected]')">Add user email</button>

Removes the current email profile from OneSignal

<button onclick="nativeFunctions.onesignalLogoutEmail('[email protected]')">Remove user email</button>

Related Articles