The Challenge of Event-Driven Marketing in Mobile Games

Mobile games generate thousands of player events every minute: level completion, item purchase, friend invitation, tournament entry, achievement unlock. Each event is a potential marketing trigger, but most games lack the infrastructure to react in real-time. The delay between event and action -- hours or days -- means lost engagement opportunities. A player who just completed a difficult level is primed for a booster pack offer, but by tomorrow that intent window has closed.

CCFish solved this by building an event-driven marketing automation engine on Cloudflare Queues. Every significant player action emits an event into a queue, and Workers process those events within seconds to trigger personalized marketing responses. The result is a system that reacts to player behavior as it happens, not on tomorrow's batch processing schedule.

Architecture: Events, Queues, and Campaign Workers

The system has four components that form an event processing pipeline:

**Event Emitter (Game Client + API Gateway):** The game client sends structured event payloads to a Cloudflare Worker endpoint. Each event includes player ID, event type, timestamp, and contextual metadata (level number, item purchased, score achieved). The Worker validates and enriches the event with player segment data from D1, then publishes it to a queue.

**Cloudflare Queue (Event Buffer):** Events land in a Cloudflare Queue configured with a 30-second visibility timeout. This acts as both a buffer during traffic spikes and a retry mechanism for failed processing. The queue supports consumer concurrency of up to 10 Workers, enabling parallel event processing without ordering guarantees. For marketing campaigns, strict ordering is not required -- processing an event 2 seconds late costs nothing, but dropping it entirely costs revenue.

**Campaign Router (Queue Consumer Worker):** A dedicated Worker consumes events from the queue and evaluates them against active campaign rules stored in D1. Each campaign rule is a JSON document specifying:

- Trigger event type (e.g., level_complete, item_purchase)

- Filter conditions (e.g., player segment = whale, events in last 24h > 3)

- Action (send push notification, unlock feature flag, grant reward)

- Cooldown period (prevent duplicate responses within 24 hours)

The router evaluates rules in priority order and executes the highest-priority matching action. Rule evaluation completes in under 150ms per event, well within the queue's 30-second visibility window.

**Action Executor (Push + Feature Flag + Reward Worker):** When a campaign rule matches, the router delegates execution to specialized Workers. Push notifications go through the timezone-aware scheduler. Feature flags are toggled via the existing CCFish flag system. In-game rewards are granted through a D1 transaction that debits a campaign budget and credits the player.

Real Campaign: The Post-Level-Completion Booster Offer

The first production campaign demonstrates the power of event-driven marketing:

- Trigger: Player completes level 10 or higher

- Filter: Player has purchased at least once (not strictly F2P), session count > 20

- Action: Offer a time-limited booster pack at 30% discount, valid for 15 minutes

- Cooldown: One offer per 72 hours per player

The campaign processes approximately 12,000 events per hour. Of those, roughly 800 match the filter criteria and trigger an offer. Conversion rate on the 15-minute window offer was 8.7%, compared to 2.1% for the same offer presented as a banner in the game shop. The urgency of a time-limited post-event offer drives 4.1x higher conversion.

Revenue from this single campaign contributed $4,200 in incremental monthly revenue with zero additional engineering cost -- the campaign was configured entirely through a JSON template in the marketing dashboard.

Results and Operational Metrics

- Average event-to-action latency: 1.2 seconds (P95: 3.8 seconds)

- Events processed per day: 288,000 (peak)

- Zero events lost in 60 days of production (verified via D1 event audit table)

- Campaign rule evaluation: <150ms per event

- Total Cloudflare Workers Free Plan cost: $0 (all within included allocation)

- Revenue from event-driven campaigns: $12,700/month across 4 active campaigns

Extending Beyond Push Offers

The same event-driven architecture powers non-monetization use cases. When a player's session count drops below their 7-day rolling average by 40%, the system triggers a re-engagement campaign. When a player refers a friend, the system immediately unlocks the referral reward and sends a thank-you notification. The event queue pattern is generic enough that marketing teams add new triggers and actions without engineering involvement -- each campaign is config JSON plus a D1 insert.

Key architectural decision: using Cloudflare Queues instead of a dedicated message broker (like RabbitMQ or Redis Streams) eliminated an entire infrastructure dependency. The queue is managed, auto-scales to zero, and costs nothing when idle. For game studios on Cloudflare Workers, event-driven marketing is essentially free infrastructure.

Key Takeaways

Event-driven marketing transforms player behavior from retrospective analytics into real-time action. The latency between what a player does and what the game does in response is the single biggest lever for marketing automation ROI. CCFish's implementation on Cloudflare Queues shows that any game already on Workers can add event-driven campaigns with zero new infrastructure cost, zero ops burden, and measurable revenue impact within the first campaign.