Chapter 22: Phase 2 - Full Product
Goal
Complete the feature set required for the Growth tier ($79/mo). Phase 2 transforms the basic Phase 1 app into a product that merchants can configure, customize, and rely on without manual intervention. By the end of Phase 2, AdPriority supports seasonal automation, a configurable rules engine, bulk operations, a dashboard with analytics, and reliable error handling.
Timeline: 3-4 weeks
Feature Set
Seasonal Automation
The seasonal automation system is the primary differentiator between the Starter and Growth tiers. It automatically adjusts product priorities when the calendar crosses a season boundary.
Components:
| Component | Description | Implementation |
|---|---|---|
| Season definitions | Start/end dates for each season | seasons table, configurable per store |
| Category-season matrix | Priority for each category group in each season | season_rules table |
| Transition scheduler | Cron job that detects boundary crossings | Bull queue, runs hourly |
| Transition preview | Shows what will change before it happens | API endpoint computing diff |
| Transition execution | Recalculates all affected products | Batch update with audit trail |
| Transition notification | Email alert when a transition occurs | Notification service |
Transition process:
SEASONAL TRANSITION
===================
Hourly cron job checks:
Is today's date in a different season than yesterday?
|
NO --+--> No action
|
YES -+--> Begin transition
|
v
1. Log transition event
|
v
2. Fetch all products for this store
|
v
3. For each product (not manually locked):
a. Look up new seasonal priority
b. Compare with current priority
c. If different: update, log change
|
v
4. Queue Google Sheet sync
|
v
5. Send notification email
|
v
6. Log completion to sync_logs
Transition safeguards:
- Manually locked products are never changed
- A dry-run mode previews changes without applying them
- Transitions log every individual product change to
audit_logs - A rollback option reverts the transition within 24 hours
Configurable Rules Engine
Phase 1 delivers hardcoded category rules based on the Nexus Clothing mapping. Phase 2 replaces these with a merchant-configurable rules engine accessible through the UI.
Rule types:
| Type | Description | Example |
|---|---|---|
| Category rule | Match product type to base priority | *Puffer Jackets* -> Priority 5 |
| Tag modifier | Adjust priority based on product tags | NAME BRAND -> +1 |
| Vendor rule | Set priority by vendor | New Era -> Priority 4 |
| Collection rule | Priority for products in a collection | “Holiday Sale” collection -> Priority 5 |
| Time-limited rule | Rule active only during a date range | Feb 1-14: Valentine’s items Priority 5 |
Rule builder UI:
The rule builder uses Polaris form components within a modal or dedicated page:
CREATE RULE
===========
Name: [Holiday Valentine Boost_______]
Description: [Boost Valentine's products____]
Conditions (ALL must match):
+------------------------------------------+
| Field | Operator | Value |
|---------------|------------|--------------|
| tag | contains | valentine25 |
| product_type | starts_with| Men-Tops |
+------------------------------------------+
[+ Add Condition]
Priority: [5 - Push Hard v]
Schedule:
( ) Always active
(*) Date range: [Feb 1] to [Feb 14]
[Cancel] [Preview (47 match)] [Save]
Rule evaluation:
- Rules are evaluated in the order specified by the merchant (drag-to-reorder)
- The first matching rule wins (no cascading)
- Tag modifiers are applied after the winning rule
- Manual overrides always take precedence
Bulk Operations
Bulk operations allow merchants to act on many products at once from the Products list screen.
| Operation | Description | Implementation |
|---|---|---|
| Set priority | Apply a specific priority to selected products | Batch update with reason |
| Recalculate | Re-run scoring engine for selected products | Queue job per batch |
| Lock/Unlock | Set or remove manual override for selected products | Toggle priority_locked |
| Export | Download selected products as CSV | Server-side generation |
Bulk operation flow:
BULK OPERATION
==============
1. Merchant selects products (checkboxes in IndexTable)
|
v
2. Clicks bulk action button (e.g., "Set Priority")
|
v
3. Modal opens: select priority, enter reason
|
v
4. Confirmation: "Update 47 products to Priority 5?"
|
v
5. POST /api/products/bulk-update
{ productIds: [...], priority: 5, reason: "Holiday promo" }
|
v
6. Backend processes in transaction:
a. Update products table
b. Write audit_logs entries
c. Set needs_sync = true
|
v
7. Queue Sheet sync job
|
v
8. Return result: { updated: 47, errors: 0 }
|
v
9. UI refreshes product list, shows success toast
For large selections (500+ products), the operation runs as a background job with a progress indicator rather than a blocking API call.
Dashboard Analytics
Phase 2 delivers the full dashboard described in Chapter 17, covering:
- Priority distribution pie chart
- Sync status indicators
- Quick stats (total products, needs attention, new arrivals)
- Activity feed (recent changes, syncs, errors)
- Seasonal transition countdown
The Pro tier analytics (ROAS by priority, Google Ads performance) remain deferred to Phase 3.
Category Management UI
A dedicated screen for managing category groups, replacing the hardcoded JSON configuration from Phase 1.
Features:
- List all category groups with member product types
- Add, edit, and delete category groups
- Assign product types to groups (autocomplete from the store’s actual types)
- Set default priority per group
- Visual indicator of ungrouped product types (types that exist in the catalog but do not belong to any group)
Sync Monitoring
An operational view showing the health and history of Google Sheet synchronization.
Components:
| Component | Description |
|---|---|
| Sync history table | Last 50 syncs with status, timestamp, product counts |
| Error detail view | Expandable rows showing specific errors per sync |
| Manual sync button | Trigger an immediate full sync |
| Sync settings | Frequency, auto-sync toggles |
Error Handling
Phase 2 hardens error handling across all integration points.
| Error Category | Handling Strategy |
|---|---|
| Shopify API rate limit | Exponential backoff, retry up to 3 times, queue for later |
| Shopify webhook delivery failure | Shopify retries automatically (19 attempts over 48 hours) |
| Google Sheets API quota | Queue writes, batch updates, alert merchant if daily quota exceeded |
| Google Sheets write failure | Retry 3 times, log error, surface in sync status |
| Database connection loss | Auto-reconnect via Prisma connection pool, surface error in health check |
| Invalid product data | Skip product, log warning, continue processing batch |
| Season transition failure | Roll back partial changes, alert via email, retry on next hour |
Beta Testing
Beta Program
Phase 2 concludes with a beta program: 5 merchants test the app in a real-world setting.
Beta merchant criteria:
| Criterion | Minimum |
|---|---|
| Shopify store | Active, with Google Ads running |
| Product count | 100-10,000 products |
| Google Ads spend | $500+/month |
| Product types | At least 5 different types |
| Seasonal variation | Catalog with seasonal demand patterns |
Beta recruitment:
- Approach through Shopify merchant communities
- Offer free Growth tier access for 60 days
- Require weekly feedback survey completion
- Collect quantitative data (ROAS before/after)
Beta Feedback Areas
| Area | Questions |
|---|---|
| Onboarding | How long did setup take? What was confusing? |
| Priority accuracy | Do the automated scores make sense for your catalog? |
| Rules engine | Were you able to configure rules for your categories? |
| Seasonal calendar | Do the season boundaries match your business? |
| Sync reliability | Did all products sync correctly to GMC? |
| Missing features | What do you need that is not available? |
| Pricing | Would you pay $79/mo for this? What price feels right? |
Iteration Based on Feedback
Allow 1 week between beta start and App Store submission for iteration. Common adjustments based on beta feedback:
| Feedback Pattern | Likely Response |
|---|---|
| “Setup was confusing” | Add onboarding wizard with step-by-step guide |
| “Wrong priorities for my catalog” | Improve default rules, add more templates |
| “My categories don’t match” | Allow custom grouping, not just product type matching |
| “Sync failed for some products” | Improve error messaging, add retry UI |
| “I need X feature” | Evaluate for Phase 3 or Growth tier scope |
Timeline
PHASE 2 TIMELINE
================
Week 1:
- Seasonal automation engine (backend)
- Season transition scheduler
- Season calendar UI
Week 2:
- Rules engine (backend CRUD + evaluation)
- Rule builder UI
- Category management UI
Week 3:
- Bulk operations (backend + UI)
- Dashboard (distribution chart, sync status, stats, activity)
- Sync monitoring UI
- Error handling hardening
Week 4:
- Beta merchant onboarding (5 stores)
- Bug fixes based on beta feedback
- Performance optimization
- Documentation for beta merchants
Deliverables
| Deliverable | Acceptance Criteria |
|---|---|
| Seasonal automation | Transitions execute automatically, preview accurate, rollback works |
| Rules engine | Merchants create/edit/delete rules, rules evaluate correctly |
| Bulk operations | Select and update 500+ products without timeout |
| Dashboard | Distribution chart, sync status, stats, activity feed all populated |
| Category management | All store product types assignable to groups |
| Sync monitoring | History viewable, errors surfaced, manual sync works |
| Error handling | No unhandled exceptions, all errors logged with context |
| Beta program | 5 merchants installed, using app for 1+ week, feedback collected |