Context
Terpli needed reliable evidence of shopper behavior after product recommendations, without asking retailers to rebuild their integrations.
A lightweight JavaScript layer captured inconsistent commerce signals across hundreds of storefronts for attribution, conversion reporting, loyalty insights, and dashboards.
Challenge
Retailers used different event names, payloads, analytics libraries, and data layers. Some signals were missing, irrelevant, or duplicated.
Custom changes by every retailer would make integration too costly to scale.
Approach
A single-file integration uses scoped monkey patching across GA4/UA, GTM/dataLayer, Fetch/XHR, postMessage, and platform-specific surfaces.
Raw payloads are preserved before filtering. Downstream ETL removes noise, deduplicates events, enriches records, and maps retailer formats into a canonical commerce schema.
Workflow
- 01
One-file installation
The recommendation plugin and tracking instrumentation ship through the same JavaScript file.
- 02
Intercept the Data River
Monkey patches observe shared browser surfaces such as Fetch, XHR, analytics libraries, and data layers.
- 03
Capture source signals
Platform-specific event names and payloads are retained with their source context.
- 04
Persist raw evidence
Captured records are stored before relevance filtering and duplicate handling.
- 05
Curate in ETL
The pipeline filters noise, deduplicates records, and maps commerce behavior into a canonical schema.

Capabilities
A single JavaScript file embedded both the recommendation plugin and its event instrumentation without requiring retailer implementation changes.
Monkey-patch interceptors for Fetch, XHR, postMessage, Google Analytics, Universal Analytics, gtag, GTM/dataLayer, and platform-specific surfaces.
Canonical event schema for view_item, add_to_cart, begin_checkout, purchase, and related commerce actions.
Raw source payload retention across Dutchie, Jane, Tymber, Dispense, LeafBridge, RankReallyHigh, and custom storefronts.
ETL filtering, enrichment, deduplication, quality checks, and curated datasets for BI and attribution.
Results
The same JavaScript asset installed for the recommendation experience also activated tracking, avoiding a second retailer integration surface.
The instrumentation supported hundreds of retailer implementations across more than seven commerce platforms without requiring changes to retailer application code.
Shared browser interception points captured commerce behavior despite retailer-specific event names, payload shapes, and analytics implementations.
Raw captured signals were persisted first; relevance filtering, canonical mapping, enrichment, and deduplication were handled downstream in ETL.
Decisions & trade-offs
Trade-offs
Direct retailer or platform changes would provide cleaner explicit contracts.
However, the coordination cost could block a partner integration.
Monkey patching traded tighter coupling to browser behavior for a viable zero-change installation path.
Filtering aggressively in the browser would reduce storage and pipeline volume.
However, could discard evidence needed to understand new platform formats.
Broad capture followed by ETL curation preserved recoverability at the cost of downstream noise.
A single canonical event schema simplified analytics.
Meanwhile, retaining source payloads preserved the retailer-specific context needed to debug mapping errors and evolve adapters.
Problems solved
Removed the need for e-commerce platform owners or retailers to modify their implementations for a recommendation partner.
Captured equivalent commerce actions even when platforms used different event names, APIs, analytics libraries, and payload formats.
Separated raw collection from ETL curation so irrelevant and duplicate records could be handled without weakening browser coverage.
Turned heterogeneous Data River signals into canonical events suitable for attribution, recommendation analytics, loyalty reporting, and BI.