Data Engineering Completed

Advanced Marketing Tracking Platform

Server-side tracking with Zaraz, PostHog and smart proxy

Advanced marketing tracking system using Cloudflare Zaraz, PostHog, vanilla JavaScript and server-side proxy, with complex conditional logic, cross-platform flow interconnection, multi-touch attribution, and server-side processing for maximum accuracy in a post-cookie world.

cloudflare
6 weeks
2023
1 engineer

The Problem

Standard GTM doesn't support the required business logic: conditional events based on multiple interactions, cross-device attribution, flows spanning domains and platforms, data loss from ad blockers, and lack of visibility into the complete user journey from first touch to conversion.

The Solution

Implemented a hybrid system: client-side tracking layer with Cloudflare Zaraz and vanilla JavaScript for basic data, complemented by server-side processing via proxy on Cloudflare Workers for complex logic. PostHog as analytics platform, events enriched with CRM data, conditional flows connecting web, email, WhatsApp, and ad interactions, and all pixels (GA4, Meta, TikTok) fed server-side.

The Results

95%+ event capture (vs ~70% client-side only), accurate full-journey attribution, complex business logic running server-side without impacting site performance, and unified dashboards connecting marketing to actual revenue.

Measurable Results

Event capture

~70%

95%+

35% improvement

Connected platforms

8+

Tracking latency

Variable

<50ms edge

Attribution window

Last click

Multi-touch 90d

Want results like these?

Let's scope your project — 30 min, no commitment.

Schedule assessment

Project Phases

Current tracking audit

1 week

Mapping all existing tags, pixels, and events. Identification of gaps, duplicates, and lost data.

Server-side architecture

2 weeks

Cloudflare Workers as tracking endpoint, event enrichment with CRM data, and forwarding to each platform.

Conditional flows

1.5 weeks

Rules engine to fire events based on combinations of prior interactions, user segments, and context.

Multi-touch attribution

1 week

Weighted attribution pipeline in PostHog, user journey dashboards, and ROI-per-channel reports.

QA & validation

0.5 weeks

End-to-end validation of each flow, comparison with historical data, and business rule documentation.

Tech Stack

Technologies

typescriptjavascriptnode.jspostgresqlredisgoogle-analytics-4meta-pixeltiktok-pixelcloudflare-zaraz

Cloud Services (CLOUDFLARE)

Cloudflare WorkersCloudflare Zaraz

Tools

posthoggoogle-analyticsmeta-business-suite

Implementation Details

Why Zaraz and server-side tracking

Traditional tracking tools fall short for complex use cases. When you need to:

  • Fire an event only if the user did X and Y and Z in the last 48 hours
  • Connect a WhatsApp interaction with a previous website visit
  • Attribute a sale to the correct combination of touchpoints
  • Avoid data loss from ad blockers or cookie restrictions

…you need logic that lives outside the browser.

Hybrid architecture

Client (Zaraz + vanilla JS)  →  CF Worker proxy (edge)  →  PostHog
                                       ↓                       ↓
                                 CRM enrichment           Attribution
                                       ↓                       ↓
                              Platform forwarding         Dashboards
                              (GA4, Meta, TikTok)

The edge Worker proxy processes each event in under 50ms, enriches it with CRM data, applies the conditional logic, and distributes it to each pixel with the correct parameters.

Have a similar technical challenge?

Let's talk about your infrastructure, architecture or pipeline. No commitment.

Schedule a Technical Assessment