Icon

Validating promo codes at the edge reduces latency and improves the user experience by quickly confirming the validity of the entered promo code. Storing promo codes and their valid date ranges in EdgeKV allows for efficient and secure validation without additional load on the origin server.

Loading...

https://www.edgecompute.live/edgekv/ecom-promocode/ecom-promocode.html

Copied to clipboard!

The Promo Code Validation example demonstrates how you can use EdgeWorkers and EdgeKV to validate promo codes at the Edge. A list of promo codes with valid date ranges is stored in EdgeKV. It also shows how you could use the getJson() helper method.

Icon landscape
Core Concepts

Helps developers understand the fundamental processes needed for edge computing.

Icon landscape
Distributed Data

Pushing data to the edge speeds up websites by avoiding central bottlenecks.

Icon landscape
Ease Development

Enable developers to modify application behavior without touching origin server logic.

Icon landscape
Reduce Latency

Speed up response times by moving work closer to users.

Related Examples

View More
Icon Card background
A/B Testing

Randomly assigns a new user to a group for A/B testing. The assignment is stored in a cookie and passed to the origin in a query parameter. The A/B group can be forced via a query string parameter for easy testing. The group names, percentage split, cookie name, and query parameter name are configured through constants in the EdgeWorker JavaScript module.

View Case
Icon Card background
A/B Testing with EdgeKV

By moving the A/B test to the Akamai edge we can cache multiple variants of the same page close to the user making the decision of which variant to serve to the user without making the long round-trip to the origin web server or relying on client-side javascript.

View Case
Icon Card background
Multivariate Testing

Enables multivariate testing where multiple tests are executed simultaneously. A single variant is selected for each test, and variants are randomly assigned to new users, with each selected variant stored in a cookie and passed to the origin in a query string parameter. The probability of choosing each variant can be configured by adjusting the weight of each variant. Variants can be forced via a query string parameter for easy testing. Custom actions can be executed in the request and/or response phase of each variant, such as routing a variant to a different origin or constructing a response at the edge.

View Case