Triggering the "Price Drop Subscription" scenario
Description
The rrApi.subscribeOnPriceDrop method subscribes a user to a product price drop notification scenario. The scenario is triggered when the newly submitted product price is lower than the previous price known to Retail Rocket.
Before calling rrApi.subscribeOnPriceDrop, call rrApi.setProfile with the user's email address so that the address is added to the Retail Rocket database.
By default, the subscription is stored for 7 calendar days. You can change the storage period by contacting Retail Rocket technical support.
If the price decreases several times during the subscription storage period, the scenario is sent several times.
Code example
<script type="text/javascript">
(window.rrApiOnReady = window.rrApiOnReady || []).push(function() {
try {
rrApi.setProfile({
"email": "example@example.com",
"isAgreedToReceiveMarketingMail": true
});
rrApi.subscribeOnPriceDrop("example@email.com", [
{ id: 3, price: 3.9 },
{ id: 4, price: 1.9 }
]);
} catch (e) {}
});
</script>
Triggering without passing an email address
Use the rrApi.subscribeOnPriceDropV2 method when you do not need to pass an email address in the call. Retail Rocket looks up the email address associated with the user's cookie if the user has previously provided an email address and it is associated with the current visitor.
<script type="text/javascript">
(window.rrApiOnReady = window.rrApiOnReady || []).push(function() {
try {
rrApi.subscribeOnPriceDropV2([
{ id: 3, price: 3.9 },
{ id: 4, price: 1.9 }
]);
} catch (e) {}
});
</script>