Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

Checking Web Push supportability

Subscribe to the "Back in Stock" trigger

Method Objective

The method

allows checking if Web Push is available in the browser. WarningWeb Push Notifications don't work in incognito mode. The method will give a false result when the browser is in that mode

subscribes the user to an email notification that the product is available.

Syntax and parameters

Code Block
languagejs
themeFadeToGrey
personaclick("subscriptionsubscribe_trigger", "webproduct_push_supportedavailable", callbackparams);

API response

ValueTypeThe result of the permission checkboolean

Example of use

Code Block
languagejs
themeFadeToGrey
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
languagejs
themeFadeToGrey
personaclick("subscription", "web_push_subscribe", callback);
NameTypeRequirementDescriptioncallbackfunctionrequiredIt's a callback function that takes a boolean value of the user's subscription result.

API response

ValueTypeThe result of subscriptionboolean
NameTypeRequirementDescription
callbackparamsfunctionObjectrequiredIt's a callback function that takes a boolean value of the check result as a parameter.

API response

ValueTypeThe result of checking Web Push supportboolean

Example of use

Code Block
languagejs
themeFadeToGrey
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
languagejs
themeFadeToGrey
personaclick("subscription", "web_push_subscribed", callback);
NameTypeRequirementDescriptioncallbackfunctionrequiredIt's a callback function that takes a boolean value of the check result as a parameter.
Object with request parameters.

Request parameters

NameTypeRequirementDescription
idnumber/stringrequiredThe product ID to notify of the product availability the user will be subscribed.
emailstringrequiredThe current user's Email.
propertiesObjectoptionally

Additional product properties. The following are available:

  • fashion_size (number/string) - clothing size. The value of the parameter in the internal format of the store.

Example of use

Code Block
languagejs
themeFadeToGrey
personaclick("subscriptionsubscribe_trigger", "webproduct_push_subscribeavailable", function(subscibed) {
    if (subscibed) {id: "100500", 
    email: "john.doe@examplestore.com",
  // if the user has subscribed to Web Push notifications
    } else properties: {
        // if the user rejects the Web Push notification subscription
    fashion_size: "XL"
    }
});



Subscribe to the "

Back in Stock

Price Drop" trigger

Method Objective

The method subscribes the user to a notification that the product is available.

TipYou don't need to check for Web Push support, permission availability, or request it from the user using the methods available here. This method will do everything you need by itself.

an email notification of a product price decrease.

Syntax and parameters

Code Block
languagejs
themeFadeToGrey
personaclick("subscribe_trigger", "product_price_availabledecrease", params);


NameTypeRequirementDescription
paramsObjectrequiredObject with request parameters.

Request parameters

NameTypeRequirementDescription
idnumber/stringrequiredThe product ID to notify of the product availability price drop the user will be subscribed.
Example of use
price
code
number
languagejs
themeFadeToGrey
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.

Tip

You don't need to check for Web Push support, permission availability, or request it from the user using the methods available here. This method will do everything you need by itself.

Syntax and parameters

Code Block
languagejs
themeFadeToGrey
personaclick("subscribe_trigger", "product_price_decrease", params);
NameTypeRequirementDescriptionparamsObjectrequiredObject with request parameters.

Request parameters

NameTypeRequirementDescription
idnumber/stringrequiredThe product ID to notify of the product price drop the user will be subscribed.
pricenumberrequiredThe current product pricerequiredThe current product price.
emailstringrequiredThe current user's Email.
propertiesObjectoptionally

Additional product properties. The following are available:

  • fashion_size (number/string) - clothing size. The value of the parameter in the internal format of the store.

Example of use

Code Block
languagejs
themeFadeToGrey
personaclick("subscribe_trigger", "product_price_decrease", {
    id: "100500", 
    price: 146.55, 
    email: "john.doe@examplestore.com",
    properties: {
        fashion_size: "XL"
    }
});


Table of Contents
maxLevel2
classpersonaclick-fixed-position