Versions Compared
compared with
Key
- This line was added.
- This line was removed.
- Formatting was changed.
Checking Web Push supportability
Method Objective
The method allows checking if Web Push is available in the browser.
Warning |
---|
Web Push Notifications don't work in incognito mode. The method will give a false result when the browser is in that mode. |
Syntax and parameters
Code Block | ||||
---|---|---|---|---|
| ||||
personaclick("subscription", "web_push_supported", callback); |
Name | Type | Requirement | Description |
---|---|---|---|
callback | functionFunction | required | It's a The callback function that takes a boolean value of the check result as a parameterthe API response. The API response type is a boolean. |
API response
TypeValue | Description | Type|
---|---|---|
boolean | The result of checking Web Push support | boolean |
Example of use
Code Block | ||||
---|---|---|---|---|
| ||||
personaclick("subscription", "web_push_supported", function(supported) { if (supported) { // if Web Push is supported } else { // if Web Push isn't supported } }); |
Checking permission status
Method Objective
The method checks if the user has permitted to show Web Push notifications.
Syntax and parameters
Code Block | ||||
---|---|---|---|---|
| ||||
personaclick("subscription", "web_push_subscribed", callback); |
Name | Type | Requirement | Description |
---|---|---|---|
callback |
Function | required |
The callback function that takes |
the API response. The API response type is a boolean. |
API response
TypeValue | Description | Type|
---|---|---|
boolean | The result of the permission check | boolean |
Example of use
Code Block | ||||
---|---|---|---|---|
| ||||
personaclick("subscription", "web_push_subscribed", function(subscibed) { if (subscibed) { // if the user has permitted Web Push notifications } else { // if the user hasn't yet permitted Web Push notifications or has rejected the request } }); |
Getting user permission
Method Objective
The method allows subscribing the user to Web Push notifications using only the system permissions window in the browser.
Tip |
---|
We recommend using the Programmatic Pop-Ups tool for more flexibility in configuring the user's subscription to Web Push notifications. |
Syntax and parameters
Code Block | ||||
---|---|---|---|---|
| ||||
personaclick("subscription", "web_push_subscribe", callback); |
Name | Type | Requirement | Description |
---|---|---|---|
callback |
Function | required |
The callback function that takes |
the API response. The API response type is a boolean. |
API response
ValueType | Description | Type|
---|---|---|
boolean | The result of subscription | boolean |
Example of use
Code Block | ||||
---|---|---|---|---|
| ||||
personaclick("subscription", "web_push_subscribe", function(subscibed) { if (subscibed) { // if the user has subscribed to Web Push notifications } else { // if the user rejects the Web Push notification subscription } }); |
Subscribe to the "Back in Stock" trigger
Method Objective
The method subscribes the user to a notification that the product is available.
Syntax and parameters
Code Block | ||||
---|---|---|---|---|
| ||||
personaclick("subscribe_trigger", "product_available", params); |
Request parameters
Example of use
Code Block | ||||
---|---|---|---|---|
| ||||
personaclick("subscribe_trigger", "product_available", {id: "100500"}); |
Subscribe to the "Price Drop" trigger
Method Objective
The method subscribes the user to a notification of a product price decrease.
Syntax and parameters
Code Block | ||||
---|---|---|---|---|
| ||||
personaclick("subscribe_trigger", "product_price_decrease", params); |
Request parameters
Example of use
Code Block | ||||
---|---|---|---|---|
| ||||
personaclick("subscribe_trigger", "product_price_decrease", {id: "100500", price: 146.55}); |
Column | ||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Page Navigation
Related Pages
|