DEV Community

Mike Sedzielewski
Mike Sedzielewski

Posted on • Originally published at Medium on

The Challenges of Managing Promo Codes: A Syntax.fm Case Study

Developers keep asking me why you need a promo engine when you can implement it yourself in a flash. From now on, I’ll show them this — the last episode of the Syntax podcast, where @wesbos and@stolinski talk about the tech stack for Syntax x @getsentry giveaway campaign.

The last episode of the Syntax podcast:

The Syntax Giveaway Site - Codes, Bots, Tech Stack and More!

Syntax web development podcast

Truth be told, I stumbled upon this episode by accident. Everyday, I inject myself with dopamine by watching “Voucherify” being mentioned all over the internet (thanks Brand24). Not everyday, however, a 350k-followers-strong developer mentions your brand in his podcast.

When it happens, you drop everything you’ve been doing and listen to the whole episode. I did so and the content wasn’t disappointing!

Wes and Scott discuss their recent giveaway campaign:

Syntax and Sentry giveaway campaign

They joined Sentry (a top platform btw, we’re using it in Voucherify) and decided to celebrate in the best possible way: by giving people some SWAG.

To get the SWAG, you had to find a promo code sprinkled around the internet to have it redeemed later on a website.

Syntax x Sentry Giveaways is one of these little, short-lived projects where you want to play with a new tech stack and Get Something Done in 2 hours tops. After all, it’s just 700 random codes representing: 600 t-shirts, 50 skate decks and 50 yeti ramblers.

But, even so, it highlights all the challenges with managing promo codes in a nutshell:

  • generating unique, hard-to-guess coupon codes — codes should be long enough to be brute-force-proof (to achieve this, Scott used our free code generator, hence the mention)
  • managing the code’s state (active, locked, used) and owner — no two users should get the same code (What if Wes and Scott want to publish a bulk of 10 codes at the same time? What if they wanted to release the locked codes 30 minutes before the show? How to make sure a single user gets only one code?)
  • supporting multiple promo code types (“premium” / “standard”) — some codes should carry a different deal than others
  • fraud protection — the system should be prepared for users who want to exploit it. (Wes claims some agents recruited their home-grown botnets to get the priceless SWAG 🤯. This caused a massive traffic spike (~1.6m requests), so Wes had to react in real-time by rolling out an in-memory cache to filter out malicious requests.)

In the end, a 2-hour-tops project turned into a few days of work for seasoned developers, a series of hotfixes to production, and significant traffic in the cloud.

Challenges with managing promo codes

I recommend listening to the whole podcast to get the full picture and some tasty insights on the tech stack Wes and Scott have chosen for the project (Vercel, Svetle, Prisma, PlanetScale, Sentry (sentry.io).

Compared to a regular ecommerce campaign, it’s just a tiny, one-off marketing campaign. If Syntax.fm would like to scale it in future, the number of challenges would increase proportionally. At least, this is what we’ve seen when working with customers over the years.

At Voucherify, we’ve been building an API-first promotion engine to help devs overcome these issues with just a few lines of codes (or 2 hours tops 🙃). We also wanted to give teams an admin panel to control promo codes without committing to prod for every business change. Finally, Voucherify is ready for scale and fraud — we handle millions of code validations a day, we can rate-limit requests from a given IP address, you can stop a campaign when you hit your targets, and many more.

Top comments (0)