Key Takeaways
- The ONDC Attribution Challenge: The decentralized nature of ONDC, separating the discovery (Buyer App) from the transaction (Seller App), breaks traditional marketing attribution models, making accurate ROI calculation nearly impossible with off-the-shelf tools.
- Custom Architecture is Non-Negotiable: To succeed on ONDC, enterprises must invest in a custom-built data pipeline to unify user journey data from ad platforms, Buyer Apps, Seller Apps, ERPs, and logistics partners.
- Profit is the New Conversion: The goal is to move beyond tracking revenue and start tracking real-time profit. This requires ingesting variable costs like Cost of Goods Sold (COGS) and shipping fees into the attribution model.
- Unlocking Google's VBB: The ultimate output of this engine is a clean, reliable stream of profit-driven conversion data, which can be fed back into Google Ads via Offline Conversion Imports to supercharge Value-Based Bidding (VBB) strategies like Target ROAS.
- The Core Components: A robust ONDC ROI engine consists of five key architectural layers: a Unified Data Ingestion Layer, a Centralized Event Bus, an Identity Resolution Service, a Multi-Touch Attribution (MTA) Core, and a Bidding Signal Activation Layer.
The ONDC Paradox: Democratized Commerce, Fragmented Data
The Open Network for Digital Commerce (ONDC) represents a paradigm shift for Indian e-commerce, aiming to unbundle the monolithic marketplace model and create a level playing field. For sellers, it opens up access to millions of users on various Buyer Network Participants (BNPs) like Paytm, PhonePe, and others. However, this democratization introduces a significant technical challenge for performance marketers: severe data fragmentation.
In a traditional e-commerce setup, the entire user journey—from ad click to discovery, cart, checkout, and post-purchase—occurs within a single, controllable domain. This allows for relatively straightforward tracking using pixels and server-side tags.
The ONDC journey shatters this model:
- A user clicks a Google Ad and lands on a product discovery page within a Buyer App (e.g., Paytm).
- They browse and add a product to their cart within that Buyer App's interface.
- The order is then routed through the ONDC Gateway to your Seller App.
- Fulfillment, shipping, and inventory are managed by your backend ERP system (e.g., ERPNext).
How do you definitively link the initial Google Click ID (GCLID) from Step 1 to the final profit margin calculated in Step 4? Off-the-shelf analytics platforms fail here. They lack the context and integration points to stitch this fragmented journey together. The result is an inability to measure true Return on Investment (ROI), leading to inefficient ad spend and a reliance on gut-feel marketing.
This blueprint outlines the architecture for a custom-built, full-funnel Performance Marketing ROI Engine designed specifically to solve the ONDC attribution problem.
Deconstructing the ONDC User Journey & Data Silos
To build a solution, we must first map the data silos across the entire customer lifecycle. Each stage presents unique tracking opportunities and challenges.

H3: The Discovery Phase on Buyer Apps
This is the top of the funnel. The user interacts with your product listings on a third-party platform.
- Available Data: Potentially UTM parameters passed through ad clicks, product view events, and add-to-cart events within the Buyer App's ecosystem.
- The Challenge: You have zero control over the Buyer App's frontend. You cannot place your own tracking scripts (pixels). Data access is limited to what the BNP chooses to expose through the ONDC protocol or their own APIs, which is often minimal.
H3: The Transaction Phase via ONDC Gateway
Once the user places an order, the request is standardized and passed to your Seller App endpoint.
- Available Data: Order details (product ID, quantity, price), user information (often anonymized or limited), and a unique transaction ID.
- The Challenge: The direct link to the initial discovery session and the original ad click is lost. The transaction ID from ONDC is the only potential key to connect the dots, but it doesn't originate from the marketing click.
H3: The Fulfillment Phase in Your ERP
Your Seller App receives the order and pushes it to your core ERP system for inventory management, payment reconciliation, and fulfillment.
- Available Data: This is your first-party data goldmine. You have COGS, inventory levels, customer details, and order status. Once shipped, you get shipping costs from your logistics partner integration.
- The Challenge: This data is completely disconnected from the top-of-funnel marketing activities. It exists in an operational silo, not a marketing analytics one.
H3: The Post-Purchase Phase
This includes handling returns, customer support interactions, and repeat purchases.
- Available Data: Return Merchandise Authorization (RMA) data, customer support tickets, and subsequent orders tied to a customer ID.
- The Challenge: This data is critical for calculating true Lifetime Value (LTV) and net profit, but it often arrives days or weeks after the initial conversion, requiring an architecture that can retroactively adjust reported conversion values.
Solving this requires architecting a central data nervous system that ingests events from every silo, stitches them together, calculates true profit, and activates that data in your ad platforms.

H3: Component 1: The Unified Data Ingestion Layer
This layer's sole purpose is to collect raw data from every source. It's built on a collection of resilient, independent microservices.
- Ad Platform Connector: Uses the Google Ads API to pull daily cost, click, impression, and GCLID data.
- Seller App Endpoint: A robust, scalable API endpoint (e.g., built with Rust or Go) that acts as your Seller App's ONDC webhook receiver. It captures every incoming order and its associated metadata.
- Headless Frontend Tracker: If your Seller App uses a headless frontend (e.g., Next.js) for any part of the experience (like post-purchase order tracking), you can implement server-side event tracking to capture more granular user behavior.
- ERP Connector: A service that polls or receives webhooks from your ERP (e.g., ERPNext) for updates on order status (shipped, delivered, returned) and, critically, pulls COGS data for each SKU.
- Logistics API Connector: Integrates with your shipping providers (e.g., Shiprocket, Delhivery) to fetch the actual shipping cost for each order ID.
H3: Component 2: The Centralized Event Bus & Data Warehouse
Raw data is useless if it's not structured for processing.
- Event Bus (Apache Kafka / AWS Kinesis): As data is ingested, it's published as standardized events (e.g.,
order_created, order_shipped, ad_click_recorded) to a central, high-throughput event stream. This decouples the ingestion layer from the processing layer, ensuring scalability and fault tolerance.
- Data Warehouse (Google BigQuery / ClickHouse): Stream processors consume events from the bus and load them into an analytical data warehouse. This becomes the "single source of truth" for all raw and processed data, optimized for the complex queries required by attribution modeling.
H3: Component 3: The Identity Resolution & Stitching Service
This is the magic. This service runs complex SQL queries or Spark jobs on the data warehouse to link disparate events into a cohesive user journey.
- The Key: The primary challenge is creating a "bridge" between the ad click and the ONDC order. One effective strategy is to pass a unique, internally generated
session_id or click_id through the ad's landing page URL. While the Buyer App may not persist this, if you can capture it at the initial interaction and somehow associate it with a user identifier (like a hashed phone number entered during checkout), you can build a probabilistic link.
- Stitching Logic: The service joins GCLID data with order data based on timestamps, product IDs, and any available user identifiers. For example: "Find all
order_created events that occurred within 30 minutes of an ad_click event for the same product SKU." This probabilistic model is refined over time with machine learning.
H3: Component 4: The Multi-Touch Attribution (MTA) & ROI Calculation Core
Once journeys are stitched, this component calculates the value.
- Beyond Last-Click: Implement advanced attribution models (e.g., U-shaped, Time Decay, or data-driven) to assign fractional credit to different marketing touchpoints.
- Calculating Profit on Ad Spend (POAS): This is the ultimate metric. For each conversion, the logic executes a formula:
Conversion_Value = Order_Revenue - SKU_COGS - Actual_Shipping_Cost - Payment_Gateway_Fee - ONDC_Commission
This value represents the true profit generated by the order.
H3: Component 5: The Bidding Signal Activation Layer
The calculated profit data must be sent back to the ad platforms to close the feedback loop.
- Google Ads Offline Conversion Formatter: This service formats the stitched conversion data into the required CSV format for Google Ads, including the original
GCLID, a ConversionName (e.g., "ONDC_Purchase"), and the calculated ConversionValue (the profit).
- Automated Upload Service: Using the Google Ads API, this service automatically uploads the conversion data to Google Ads on a daily or intra-day basis. This consistent stream of high-quality, profit-driven data is exactly what Google's Value-Based Bidding algorithms need to perform optimally.
The Technology Stack: Building for Scale and Compliance
- Backend & Data Processing:
- Microservices: Go or Rust for high-performance, low-latency ingestion endpoints. Node.js for less performance-critical services.
- Event Streaming: AWS Kinesis or a managed Kafka service like Confluent Cloud.
- Data Warehouse: Google BigQuery for its serverless nature and excellent integration with Google Ads. ClickHouse is a powerful open-source alternative for real-time analytics.
- Infrastructure:
- Serverless: AWS Lambda and EventBridge are perfect for event-driven workflows, offering scalability and cost-efficiency.
- Containerization: Kubernetes (EKS/GKE) for orchestrating complex, stateful services like the attribution core.
- Seller App & Frontend:
- Headless Architecture: A Next.js frontend for any seller-controlled touchpoints, enabling powerful server-side tracking and API integrations.
- DPDP Act Compliance:
- Architect for data minimization from day one. Do not ingest or store PII unless absolutely necessary.
- Use hashing (e.g., SHA-256) for any user identifiers used for stitching.
- Integrate a robust Consent Management Platform (CMP) to manage user consent for data processing.

Frequently Asked Questions (FAQ)
Q1: How does this custom engine differ from a standard Google Analytics 4 (GA4) integration?
GA4 relies on its own event-based model and identity graph, which are largely contained within web and app properties you control. It cannot see inside the ONDC Buyer App ecosystem. It will see the ad click exit to the Buyer App and, separately, may see a conversion on your domain if the user lands there post-purchase, but it cannot natively connect the two. This custom engine is built specifically to bridge that "black box" in the middle of the ONDC journey.
Q2: What's the single biggest technical hurdle in stitching user identity across ONDC?
The lack of a persistent, cross-platform identifier that can be passed from the ad network through the Buyer App to the Seller App. Solving this requires a combination of engineering ingenuity (passing unique IDs in URL parameters), data science (probabilistic matching), and leveraging any consistent data points the ONDC protocol provides, like a hashed user phone number if available and DPDP-compliant.
Q3: Can this ROI engine be adapted for other ad platforms like Meta Ads?
Absolutely. The architecture is platform-agnostic. The Ingestion Layer would need a new connector for the Meta Marketing API to pull cost data and user identifiers (like fbc or fbp cookies, where possible). The Activation Layer would be modified to send data back to Meta via its Conversions API (CAPI), which serves a similar purpose to Google's Offline Conversions.
Q4: How does this architecture handle product returns and order cancellations in ROI calculations?
This is a critical feature. The ERP Connector continuously monitors for status changes. When an order is marked as "Returned," it triggers a new event. The ROI Calculation Core processes this event, and the Activation Layer sends a "retraction" or a negative conversion value back to Google Ads for the original GCLID. This ensures the bidding algorithms are not optimizing based on revenue that was ultimately refunded, further refining the accuracy of your POAS metric.
Q5: What is a realistic timeframe to build and deploy a Minimum Viable Product (MVP) of this engine?
For an experienced engineering team, an MVP can be architected and deployed in 3-4 months. The MVP would focus on the core pipeline: ingesting data from Google Ads and your ERP, implementing a basic stitching logic based on timestamps and product data, calculating profit, and automating the upload to Google Ads. More advanced features like multi-touch attribution and real-time processing can be added in subsequent phases.
Conclusion: Turn ONDC's Challenge into Your Competitive Advantage
Navigating the ONDC ecosystem requires a fundamental shift in how businesses approach marketing measurement. Relying on outdated, last-click attribution models is a recipe for wasted ad spend and missed opportunities. The future of performance marketing on ONDC belongs to those who invest in building a dedicated, first-party data infrastructure.
By architecting a custom Full-Funnel ROI Engine, you transform the network's inherent data fragmentation from a crippling weakness into a powerful competitive advantage. You gain the clarity to understand your true profitability, the control to optimize every marketing dollar, and the data foundation to scale your business intelligently on India's next great e-commerce wave.
Ready to architect a high-performance ONDC marketing engine?
The technical challenges are significant, but the potential returns are transformative. The expert team at Induji Technologies specializes in building complex, scalable data architectures and custom software solutions that drive real business results.
Request a Quote Today to discuss how we can build a custom ONDC ROI engine tailored to your enterprise needs.