Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 12 Next »

Subscribe to the "Back in Stock" trigger

Method Objective

The method subscribes the user to the notifications that the product is available.

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

Syntax and parameters

personaclick("subscribe_trigger", "product_available", params);

NameTypeRequirementDescription
paramsObjectrequiredObject with request parameters.

Request parameters

NameTypeRequirementDescription
itemnumber/stringrequiredThe product ID to notify of the product availability the user will be subscribed.
emailstringoptionallyThe current user's Email. If not set, the subscription will be on Web Push notification.
webpushbooleanoptionallyThis property, if true, additionally adds the Web Push notification subscription for the specified product.
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.

Examples of use

// subscribing to both channels: Email and Web Push Notifications
personaclick("subscribe_trigger", "product_available", {
    item: "100500", 
    email: "john.doe@examplestore.com",
    webpush: true,
    properties: {
        fashion_size: "XL"
    }
});

// subscribing to Email Notification only
personaclick("subscribe_trigger", "product_available", {
    item: "100500", 
    email: "john.doe@examplestore.com"
});

// subscribing to Web Push Notification only
personaclick("subscribe_trigger", "product_available", {
    item: "100500"
});


Unsubscribe from the "Back in Stock" trigger

Method Objective

The method unsubscribes the user from the notification that the product is available.

Syntax and parameters

personaclick("unsubscribe_trigger", "product_available", params);

NameTypeRequirementDescription
paramsObjectrequiredObject with request parameters.

Request parameters

NameTypeRequirementDescription
item_idsarrayrequiredAn array of product IDs for which the user would like to unsubscribe from the product availability notification. You can use an empty array to unsubscribe from all products.
emailstringrequiredThe current user's Email.

Examples of use

personaclick("unsubscribe_trigger", "product_available", {
    item_ids: ["100500", "146", "12"], 
    email: "john.doe@examplestore.com"
});

personaclick("unsubscribe_trigger", "product_available", {
    item_ids: [], // unsubscribe from all products
    email: "john.doe@examplestore.com"
});


Checking the "Back in Stock" trigger subscription

Method Objective

The method allows checking the subscription status of the "Back in Stock" trigger.

Syntax and parameters

personaclick("check_trigger", "product_available", params, success, error);
NameTypeRequirementDescription
paramsObjectrequiredObject with request parameters.
successFunctionrequiredCallback-function, where the API response will be passed to. Response type: object.
errorFunctionoptionallyCallback-function to be called when an error occurs (any HTTP status code other than 200).

Request parameters

NameTypeRequirementDescription
itemarrayrequiredAn array of product IDs for which the user would like to unsubscribe from the product availability notification. You can use an empty array to unsubscribe from all products.
emailstringoptionallyEmail for subscription checking.
phonestringoptionallyPhone for subscription checking.
loyalty_idstringoptionallyLoyalty ID for subscription checking.

If no email, phone, or loyalty_id is specified, only the user's current device will be checked. It won't take into account subscriptions performed on the user's other devices.

Example of use

personaclick("check_trigger", "product_available", {
    item: "100500", 
    email: "john.doe@examplestore.com"
});
personaclick("check_trigger", "product_available", {
    item: "100500"
});


Subscribe to the "Price Drop" trigger

Method Objective

The method subscribes the user to the notifications of a product price decrease.

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

Syntax and parameters

personaclick("subscribe_trigger", "product_price_decrease", params);

NameTypeRequirementDescription
paramsObjectrequiredObject with request parameters.

Request parameters

NameTypeRequirementDescription
itemnumber/stringrequiredThe product ID to notify of the product price drop the user will be subscribed.
pricenumberrequiredThe current product price.
emailstringoptionallyThe current user's Email. If not set, the subscription will be on Web Push notification.
webpushbooleanoptionallyThis property, if true, additionally adds the Web Push notification subscription for the specified product.
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.

Examples of use

// subscribing to both channels: Email and Web Push Notifications
personaclick("subscribe_trigger", "product_price_decrease", {
    item: "100500", 
    price: 146.55, 
    email: "john.doe@examplestore.com",
    webpush: true,
    properties: {
        fashion_size: "XL"
    }
});

// subscribing to Email Notification only
personaclick("subscribe_trigger", "product_price_decrease", {
    item: "100500", 
    price: 146.55, 
    email: "john.doe@examplestore.com"
});

// subscribing to Web Push Notification only
personaclick("subscribe_trigger", "product_price_decrease", {
    item: "100500", 
    price: 146.55 
});


Unsubscribe from the "Price Drop" trigger

Method Objective

The method unsubscribes the user from an email notification of a product price decrease.

Syntax and parameters

personaclick("unsubscribe_trigger", "product_price_decrease", params);

NameTypeRequirementDescription
paramsObjectrequiredObject with request parameters.

Request parameters

NameTypeRequirementDescription
item_idsarrayrequiredAn array of product IDs for which the user would like to unsubscribe from the price drop notification. You can use an empty array to unsubscribe from all products.
emailstringrequiredThe current user's Email.

Examples of use

personaclick("unsubscribe_trigger", "product_price_decrease", {
    item_ids: ["100500", "146", "12"], 
    email: "john.doe@examplestore.com"
});

personaclick("unsubscribe_trigger", "product_price_decrease", {
    item_ids: [], // unsubscribe from all products
    email: "john.doe@examplestore.com"
});


Checking the "Price Drop" trigger subscription

Method Objective

The method allows checking the subscription status of the "Price Drop" trigger.

Syntax and parameters

personaclick("check_trigger", "product_price_decrease", params, success, error);
NameTypeRequirementDescription
paramsObjectrequiredObject with request parameters.
successFunctionrequiredCallback-function, where the API response will be passed to. Response type: object.
errorFunctionoptionallyCallback-function to be called when an error occurs (any HTTP status code other than 200).

Request parameters

NameTypeRequirementDescription
itemarrayrequiredAn array of product IDs for which the user would like to unsubscribe from the product availability notification. You can use an empty array to unsubscribe from all products.
emailstringoptionallyEmail for subscription checking.
phonestringoptionallyPhone for subscription checking.
loyalty_idstringoptionallyLoyalty ID for subscription checking.

If no email, phone, or loyalty_id is specified, only the user's current device will be checked. It won't take into account subscriptions performed on the user's other devices.

Example of use

personaclick("check_trigger", "product_price_decrease", {
    item: "100500", 
    email: "john.doe@examplestore.com"
});
personaclick("check_trigger", "product_price_decrease", {
    item: "100500"
});

  • No labels