How it Works
Ventrata allows you to apply promotions to products in multiple ways:
using dashboard settings to enable promotions across multiple channels,
allowing customers to manually enter promo codes during the checkout flow.
For more details on these methods, refer to the linked articles in each bullet point.
This article focuses on programmatic methods for applying live promotions through:
Ventrata automatically extracts the promo code value from either:
the
data-config
attribute (method 1)the URL query parameter (method 2)
or stores the promo code value in Session Storage, see Dynamic Promo Code Insertion (method 2)
Once extracted, the promo code is included in the payload for availability and calendar requests.
π TIP
A request payload contains the data sent from the user's browser to the server when making a request (such as checking availability or booking a ticket).
1. Update Data-Config
1. Update Data-Config
This method requires access to the data-config
attribute. See the Implementation Guide for more information.
How to Implement
Modify the
data-config
attribute to include thepromoCode
value:<button type="button" data-config='{"productID":"[YOUR_APIKEY]", "promoCode": "[PROMO_CODE]"}' ventrata-checkout > Book Now </button>
β
π NOTEYou can specify the
promoCode
value either in the script or directly above the required button.Once the
promoCode
value is extracted from thedata-config
, it is included in the payload for availability and calendar requests. For more details, see how it works.
2. Dynamic Promo Code Insertion
2. Dynamic Promo Code Insertion
You can apply the promotion by dynamically extracting the promoCode
value from the URL query parameters.
There are two ways to dynamically insert a promo code from the URL query parameters:
1. Session Storage
This method ensures that the promoCode
value persists even if the promo code is no longer present in the URL. Session Storage keeps promo code active for as long as the browser tab remains open.
π TIP
Session Storage is temporary and only lasts while the browser is open. Once the user closes the browser tab or quits the browser, the data is cleared.
2. Query Parameter from the URL
If you share a URL like:
Ventrata automatically extracts the FREE
value from the URL and stores it in:
Session Storage
Payload for availability and calendar requests
Verify Promotion Insertion
Make a Test Booking
To verify that the promo code has been applied, make a test booking. The respective product will be discounted by the promotion value or made free, depending on the promotion settings.
Inspect Payload
You can verify the applied promo code in your browser's developer tools.
Open your web checkout and select a unit and time slot on the product with the promo code.
Open the developer tools in your browser (F12 or right click anywhere on the page > select Inspect).
Navigate to the Network tab.
Select the 'availability' or 'calendar' request in the 'Name' column.
On the right-hand side, switch to the Payload tab.
Look for the "offerCode" parameter in the Request Payload.
Confirm that the code used matches the expected promo code.