Custom Triggers

Custom triggers let you unlock gift tiers from your own code. Unlike spend, quantity, or product-in-cart triggers that activate automatically, custom triggers fire when you call the Omake JavaScript API — giving you full control over when and why a customer earns a gift.

Setting up a custom trigger tier

Go to **Your Omake** page, click **Add tier**. Select **Custom trigger** as the trigger type. Enter an event name (e.g., `loyalty_member`, `referral_complete`, `newsletter_signup`). Add your gift products. Save the tier.

Triggering from JavaScript

// Trigger the event — unlocks matching tiers
await Omake.trigger('loyalty_member');

// Revoke the event — re-locks matching tiers
await Omake.revoke('loyalty_member');

Always wait for the omake:ready event before calling trigger methods. See the JavaScript API page for details.

Event name rules

  • Letters, numbers, underscores (_), hyphens (-), dots (.), and equals signs (=) only
  • Maximum 100 characters
  • Case-sensitive: Loyalty_Member and loyalty_member are different events

How triggers persist

  • Triggers are stored in the browser's localStorage with a 14-day expiry
  • If a customer triggers an event and comes back within 14 days, the trigger is still active
  • Triggers are also synced to the cart for server-side verification
  • When a customer starts a new cart (e.g., after checkout), triggers from localStorage are re-synced automatically

Triggers expire after 14 days. If your use case needs longer persistence, re-trigger the event on each visit (e.g., by checking your own loyalty system on page load).

Use cases

Loyalty programs

Trigger a gift when a customer is identified as a loyalty member:

if (isLoyaltyMember) {
  Omake.trigger('loyalty_member');
}

Referral codes

Trigger a gift when a referral code is validated:

if (referralCodeValid) {
  Omake.trigger('referral_complete');
}

Popup interactions

Trigger a gift when a customer completes a popup action (e.g., email signup):

onPopupSubmit(function() {
  Omake.trigger('popup_signup');
  Omake.addOmake(); // Add the gift bag if not already in cart
});

External systems

Trigger from any system that can run JavaScript on the storefront — Klaviyo, custom scripts, third-party integrations:

document.addEventListener('omake:ready', function() {
  Omake.trigger('vip_customer');
});

Combining with conditions

Custom trigger tiers can also have URL parameter conditions. When both are set, the tier unlocks when the custom trigger is active AND a matching URL parameter is present. See URL Parameter Conditions for details.