Custom CRM Plugin for Advertising Agency: WordPress & WooCommerce

Case Study: Maximum Advertising Plugin

A custom CRM built on WordPress – designed, directed, and shipped with AI assistance.

Overview

Type Custom WordPress plugin (internal tool)
Stack PHP, JavaScript, WordPress, WooCommerce, Stripe API, AdvertServe API
Role Sole product owner and developer
Development approach AI-assisted (Claude)

The Problem

Running an advertising agency involves a complex operational chain: leads come in, get assigned to agents, turn into proposals, proposals become paid campaigns, campaigns need creative assets uploaded and scheduled with publishers, and eventually commissions need to be paid out. Generic CRM tools handle pieces of this but not the whole workflow. Custom solutions typically require a development team and significant budget. The goal was to build a fully custom internal tool that managed the entire lifecycle – without any off-the-shelf CRM subscription, and as a solo operator using AI as a development partner.

The Approach

Rather than building from scratch, the project used WordPress and WooCommerce as a foundation – extending them into a B2B operations platform. This meant repurposing WooCommerce orders as proposals, building custom admin dashboards for each user role, and adding Stripe payment infrastructure on top. Claude was used throughout as a coding collaborator. The human contribution was the product vision, architectural decisions, business logic, quality control, and ongoing direction. Code was reviewed, tested, and iterated on in production.
The point wasn’t to hide that AI was involved. It was to use it effectively – knowing what to ask for, recognizing when output was wrong, and making the product decisions that an AI can’t make on its own.

What Was Built

Sales and CRM

Kanban-style pipeline dashboard, lead capture forms, agent assignment, proposal creation from WooCommerce draft orders, task tracking with notes, and a landing page custom post type with inquiry management. The plugin includes a behavior-triggered automation layer: customer actions (form submissions, payment events, status changes, and other lifecycle triggers) automatically generate and assign tasks to the appropriate sales agent, ensuring nothing falls through the cracks without any manual intervention.

Fulfillment

Creative upload and scheduling system, per-publisher dashboards behind magic-link authentication, delivery tracking, and automatic order completion when all ad placements are confirmed published.

AdvertServe API Integration

The plugin integrates directly with AdvertServe, the company’s ad serving platform, to automate campaign trafficking. When a proposal is approved and paid, the plugin creates and configures campaigns, ad zones, and creatives in AdvertServe via its API – eliminating manual data entry between the CRM and the ad server. This was technically the most complex integration in the project: AdvertServe’s API requires multi-step object creation with strict dependency ordering (advertiser before campaign, campaign before zone, zone before creative), stateful session handling, and custom error recovery logic for partial failures mid-sequence. Getting this right meant the sales-to-live-campaign workflow could be completed entirely within the plugin without any manual handoff.

Payments and Finance

Forced Stripe tokenization at checkout, admin-initiated off-session charging, accounts receivable tracking, and agent/publisher commission payout management.

Access Control

Four distinct user roles (admin, agent, publisher, advertiser) with tailored dashboards, capability-gated menus, and passwordless magic-link login for external publishers.

Technical Highlights

Performance Optimization

Early versions of the pipeline page executed 400+ database queries on load. Through profiling, N+1 query patterns were identified and resolved using batch fetching and WordPress object cache priming – bringing the same page down to 10-15 queries, a 95% reduction.

Security

Security was treated as a first-class concern throughout: nonce verification on all form submissions, capability checks on all admin actions, input sanitization and output escaping, and a full permissions audit documented in the repository.

Architecture

The plugin follows a module-based architecture with a consistent naming convention, namespace isolation under MA\, and a ::boot() pattern for class initialization. This keeps the codebase navigable and extensible despite its scope.

Results

Metric Result
Sales processed through the platform (last 6 months) $250,000+
Pipeline page query reduction 95% (400+ → 10-15)
Fulfillment page query reduction 85% (200-400 → 20-30)
Payouts page query reduction 90% (150-300 → 15-25)
Custom user roles 4
PHP modules in production 15+

Skills Demonstrated

  • WordPress plugin architecture
  • WooCommerce extension and customization
  • Stripe API integration (off-session charges, Stripe Connect)
  • AdvertServe API integration (multi-step campaign trafficking, stateful session management, dependency-ordered object creation)
  • PHP backend development (AJAX, custom post types, role systems)
  • Vanilla JavaScript and asynchronous UI (task drawers, modals, pagination)
  • Database query optimization and cache priming
  • Behavior-triggered automation (task assignment based on customer lifecycle events)
  • Role-based access control
  • Security-first development practices
  • AI-directed development and code review
  • Product ownership and system design
keeping the codebase navigable despite its scope.

More Writings