Project Overview
Preserving B2B Attribution in E-commerce Integrations
This wellness brand sells professional skincare products through two channels: wholesale to spas and clinics (B2B), and direct to consumers (D2C). Same products, completely different sales processes.
Their B2B operation is high-touch. A sales rep builds a relationship with a spa owner over weeks—sending sample kits, scheduling calls, creating custom proposals, and negotiating pricing. Eventually, the spa owner places their first “Opening Order”—often $2,000+ in wholesale product.
After that first sale, the process changes. The spa logs into Shopify whenever they need to reorder. No rep involvement. Just standard e-commerce fulfillment.
The Architecture Gap
The native HubSpot-Shopify integration treats both phases identically. When that Opening Order finally converts after weeks of sales effort, Shopify creates an Order record in HubSpot. Revenue appears in the system. But that Order has no connection to the Deal the rep had been working on.
- The Break: The integration creates a standalone transaction record, effectively erasing the weeks of sales work that preceded it.
- The Result: Attribution vanishes. Marketing couldn’t trace which campaigns drove B2B accounts, sales reps couldn’t prove which deals they’d closed, and the data layer underneath was unreliable.
- The Data Mess: Customer classification relied on free-text Shopify tags where “B2B,” “b2b,” and “Wholesale” all meant the same thing but appeared as different values in reports.
Orders vs. Deals
The client initially wanted everything tracked through Orders. One object type, simpler reporting. Creating parallel Deal records felt like duplication. They explicitly asked: “Why should we make it twice? It’s already in here.”
We established that for accurate attribution, Orders and Deals must be handled as separate data objects:
- Orders track fulfillment—what shipped, what arrived.
- Deals track the sales process—which channel generated the lead, how many touchpoints occurred, time-to-close.
Using Orders alone means seeing what sold but never understanding why. For B2B operations where reps spend weeks nurturing accounts, this isn’t academic—it’s the difference between a revenue system and a shipping tracker.
The Solution
Building Middleware for B2B Attribution
The fix required three layers: clean data at the source, custom middleware to bridge the Orders-Deals gap, and simplified interfaces for daily use.
1. Operations Hub for Data Standardization
We couldn’t build reliable automation on top of messy data. We used Operations Hub Starter—an investment less than the cost of a single client meeting—to transform free-text tags into structured properties at the integration layer.
Now, when a record syncs from Shopify:
- “B2B,” “b2b,” “Wholesale,” “Pro” → Standardized to Customer Type: B2B
- “Consumer,” “D2C” → Standardized to Customer Type: D2C
This happens before records reach workflows or reports. Clean data from the start.
2. Enforcing the Deals Object
We built a Deals-based architecture specifically for the B2B sales motion:
- For Recurring Orders: When customers reorder through Shopify, a workflow detects it is a “Recurring Order,” creates a new Deal, marks it Closed Won, and syncs the line items. Standard HubSpot workflows handle this perfectly well.
- For Opening Orders: This is where standard implementations break, and where we needed a custom solution.
3. Custom Middleware for Opening Orders
The “Opening Order” problem presents a logic challenge: The Deal exists first (the rep has been working on it in HubSpot for weeks). The Order gets created later (when the customer checks out in Shopify). We need to associate that new Order with the existing Deal retroactively.
HubSpot workflows can’t do this—they create associations at the moment of creation, and they cannot search backward for existing records.
We built Zapier middleware to solve it. Here’s how the logic routes based on customer type:
(Ops Hub Property)
Standard fulfillment tracking. No deal attribution required.
Updates rep’s deal, syncs line items, credits commission automatically.
The rep gets automatic credit. Attribution reporting works—you can trace that wholesale account back to the webinar registration that started it six weeks ago.
4. Sales Workspace as Simplified Interface
Complex backend architecture means nothing if users can’t operate it. We configured the Sales Workspace as the single interface for reps.
- Filtered Views: Showing only their B2B Deals.
- Isolated Pipeline: D2C traffic routes automatically to nurture tracks, keeping the B2B views noise-free.
We didn’t train sales reps to be “HubSpot experts.” We made HubSpot invisible. They come in, see their accounts, work their deals, and hit their numbers. The middleware handles the complexity behind the scenes.
The Results
- 100% Attribution Visibility: Marketing can now trace B2B accounts back to source campaigns. Sales leadership sees which channels drive wholesale revenue. Reps get automatic credit when deals close.
- Automated Commission Tracking: Reps don’t manually claim orders or update deal values. The middleware links revenue to their deals automatically.
- Internal Capability: By the end of the project, the client’s internal team was proficient enough to build their own workflows and troubleshoot routine issues, reducing reliance on external support.
The Pattern
Why This Matters Beyond One Client
E-commerce platforms treat every transaction as an isolated event. HubSpot’s native Shopify sync inherits this—it creates Orders automatically but can’t retroactively associate them with pre-existing Deals.
This breaks the data model for any business running B2B and D2C simultaneously through Shopify. Manufacturers scaling wholesale divisions, medical device companies with rep-driven sales, and professional equipment distributors all face the same gap.
When your first sale is a process and subsequent sales are transactions, native integrations can’t distinguish between “a rep worked this for six weeks” and “someone clicked checkout.”
Most agencies tell clients, “Just turn on the Shopify sync.” Six months later, attribution reporting captures transactions but misses the sales effort.
The Takeaway
If your sales process involves high-touch rep activity for the first purchase followed by low-touch recurring orders, the standard Shopify-HubSpot sync will erase the first part of that story. Your CRM will capture fulfillment but miss the sales process.
Fixing this means recognizing when native tools fail and building middleware to preserve business logic. It means not accepting the “easy path” when it breaks your actual revenue operations.
Because at the end of implementation, your CRM should answer the real questions: What’s working? Which channels drive wholesale accounts? What’s our pipeline velocity by segment? If your integration can’t answer those questions, it’s not finished—even if data is syncing.
Running B2B Operations Through E-commerce Platforms?
If you’re tracking wholesale accounts alongside retail sales and losing attribution visibility in the process, this is a problem we’ve solved before. Let’s talk about your specific integration architecture. Contact a Hypha expert today.
