Campaign Engine
Azotte's campaign engine enables sophisticated promotional strategies with rule-based targeting, dynamic pricing, and real-time application.
Engine Architecture
Campaign Types
Discount Campaigns
- Percentage Discounts: 10% off, 25% off, etc.
- Fixed Amount: $5 off, $20 off specific amounts
- Buy X Get Y: BOGO offers, bulk discounts
- Tiered Discounts: Progressive discounts based on quantity
Trial Extensions
- Extended Trials: 30-day to 60-day extensions
- Premium Trials: Access to higher tier during trial
- Feature Trials: Specific feature access extensions
- Conditional Trials: Performance-based extensions
Referral Programs
- Customer Referrals: Rewards for successful referrals
- Partner Referrals: B2B partnership incentives
- Multi-tier Referrals: Cascading reward systems
- Viral Incentives: Exponential growth rewards
Rules Engine
Eligibility Conditions
interface EligibilityRule {
type: 'customer' | 'subscription' | 'geographic' | 'temporal' | 'behavioral';
operator: 'equals' | 'contains' | 'greater_than' | 'in_range' | 'matches';
field: string;
value: any;
negate?: boolean;
}
Rule Examples
[
{
"type": "customer",
"field": "registration_date",
"operator": "greater_than",
"value": "2024-01-01"
},
{
"type": "geographic",
"field": "country",
"operator": "in",
"value": ["US", "CA", "UK"]
},
{
"type": "subscription",
"field": "current_plan",
"operator": "equals",
"value": "basic"
}
]
Complex Rule Logic
interface CampaignRules {
conditions: {
all?: EligibilityRule[]; // AND logic
any?: EligibilityRule[]; // OR logic
none?: EligibilityRule[]; // NOT logic
};
priority: number;
stackable: boolean;
max_applications_per_customer: number;
}
Dynamic Pricing Engine
Discount Calculation
class DiscountCalculator {
calculateDiscount(campaign: Campaign, basket: Basket): Discount {
switch (campaign.type) {
case 'percentage':
return this.calculatePercentageDiscount(campaign, basket);
case 'fixed_amount':
return this.calculateFixedDiscount(campaign, basket);
case 'buy_x_get_y':
return this.calculateBOGODiscount(campaign, basket);
case 'tiered':
return this.calculateTieredDiscount(campaign, basket);
}
}
}
Price Modification Pipeline
- Base Price Calculation: Original bundle/price calculation
- Campaign Application: Apply eligible campaigns in priority order
- Conflict Resolution: Handle overlapping campaigns
- Final Validation: Ensure minimum price thresholds
- Tax Calculation: Apply taxes to final discounted price
Real-Time Campaign Evaluation
Checkout Integration
interface CampaignEvaluation {
evaluateAtCheckout(context: CheckoutContext): ApplicableCampaigns {
const eligibleCampaigns = this.findEligibleCampaigns(
context.customer,
context.basket,
context.storefront
);
return this.resolveCampaignConflicts(
eligibleCampaigns,
context.preferences
);
}
}
Performance Optimization
- Campaign rule caching
- Pre-computed eligibility indexes
- Lazy evaluation of complex rules
- Circuit breaker for rule evaluation timeouts
Campaign Stacking and Conflicts
Stacking Rules
stacking_policy:
default_behavior: "exclusive" # or "stackable"
max_stacked_campaigns: 3
priority_resolution: "highest_discount" # or "highest_priority"
conflict_resolution:
- if: "same_type"
action: "take_best"
- if: "overlapping_products"
action: "combine_if_stackable"
- if: "exceeds_max_discount"
action: "cap_at_threshold"
Priority Matrix
| Campaign Type | Default Priority | Can Stack |
|---|---|---|
| Flash Sale | 100 | No |
| First Purchase | 90 | Yes |
| Loyalty Reward | 80 | Yes |
| Volume Discount | 70 | No |
| Referral Bonus | 60 | Yes |
Behavioral Triggers
Event-Based Activation
- Cart Abandonment: Re-engagement campaigns
- Subscription Expiry: Renewal incentives
- Usage Milestones: Achievement-based rewards
- Referral Events: Viral growth activation
Machine Learning Integration
interface MLTriggers {
churnPrediction: (customer: Customer) => ChurnScore;
upsellProbability: (customer: Customer, bundle: Bundle) => UpgradeScore;
priceElasticity: (customer: Customer, price: Price) => ElasticityScore;
}
A/B Testing Framework
Campaign Variations
{
"campaign_id": "summer_sale_2024",
"variations": [
{
"id": "variant_a",
"name": "20% Off",
"discount_percentage": 20,
"traffic_allocation": 50
},
{
"id": "variant_b",
"name": "$25 Off",
"discount_fixed": 2500,
"traffic_allocation": 50
}
],
"success_metrics": ["conversion_rate", "revenue_per_visitor", "aov"]
}
Statistical Analysis
- Confidence interval calculation
- Statistical significance testing
- Bayesian analysis for early stopping
- Multi-armed bandit optimization
Performance Analytics
Key Metrics
- Conversion Rate: Campaign impact on purchases
- Revenue Impact: Total revenue attributed to campaigns
- Customer Acquisition Cost: Cost per acquired customer
- Return on Investment: Campaign ROI calculation
Real-Time Dashboard
Campaign Performance Dashboard
┌──────────────────────────────────────┐
│ Campaign Status Conv% Revenue │
├──────────────────────────────────────┤
│ Summer Sale ✓ LIVE 12.3% $45,230 │
│ New Customer ✓ LIVE 8.7% $23,100 │
│ Loyalty Pro ⚠ LOW 3.2% $8,450 │
│ Flash Friday ✗ ENDED 15.6% $67,890 │
└──────────────────────────────────────┘
Campaign Lifecycle Management
Automated Scheduling
- Time-based activation and deactivation
- Inventory-based campaign limits
- Budget threshold management
- Performance-based auto-optimization
Manual Controls
- Emergency campaign pause
- Real-time parameter adjustment
- Audience expansion/contraction
- Budget reallocation
Next Steps
- Learn about Entitlement System
- Understand Developer Integration
- Explore Portal Campaign Management