Push Registration and Privacy Consent
By default your app will automatically prompt the user to allow push notifications on the first launch of the app. You may optionally delay the push notification prompt and trigger manually via Javascript. By default your app will automatically transmit data to OneSignal including obtaining a `oneSignalUserId`. To facilitate privacy policy compliance you may optionally defer communication with OneSignal until consent is provided by the user.
Delaying Push Notification Registration
To disable automatic registration and prompt for user permission at run-time, set Automatic Registration to Disable within your app configuration. Then, use the Median JavaScript Bridge to trigger the prompt for push notification registration at run-time by calling the following command:
↔️Median JavaScript Bridge
median.onesignal.register();
<a onclick="median.onesignal.register()">Enable Push Notifications</a>
Note: This functionality is only applicable for iOS and Android 13+.
Initialization vs Push Registration
Even if you delay push registration, the device will still initialize with OneSignal and obtain a
oneSignalUserId
. To defer initialization and communication with OneSignal refer to the following section on privacy.
Explicitly grant OneSignal permission to transmit device data
By default, your app will automatically send device data to OneSignal to initialize. This includes obtaining a oneSignalUserId
which can be used to associate the device and user. To facilitate GDPR compliance, you may optionally defer sending data until consent is received from the user.
To request explicit consent from the user before any device data is sent to OneSignal, set Require user privacy consent before transmitting data to Enable in your app configuration. Then use the Median JavaScript Bridge to grant and revoke consent using the command listed below. Once consent has been granted the device will initialize with OneSignal and a oneSignalUserId
will be assigned and sent to the device.
↔️Median JavaScript Bridge
To grant privacy consent, run the following command. If Automatic Registration is not Disabled (see above) the push notification prompt will then be displayed to the user.
median.onesignal.userPrivacyConsent.grant();
<a onclick="median.onesignal.userPrivacyConsent.grant()">Consent to Push Notification Privacy Policy</a>
To revoke push notification consent run the following command:
median.onesignal.userPrivacyConsent.revoke()
<a onclick="median.onesignal.userPrivacyConsent.revoke()">Revoke Push Notification Privacy Consent</a>
Revoking Privacy Consent
Revoking OneSignal privacy consent stops your app from sending additional data to OneSignal, but does not prevent receiving push notifications.
To control which users receive which notifications consider using Tags within OneSignal.
Updated about 2 months ago