WorkDigital platforms

Al Hatab Links: take people to the right place, and keep the campaign in view.

A link in a message or on a package needs a useful destination, whether someone has the app or is browsing the web. We built Al Hatab’s link service to route those visits and record their campaign context on the brand’s own domain. The Worker is deployed; the updated app integration is awaiting release and device verification.

Organisation
Al Hatab Foods, Saudi Arabia
Role
Architecture and engineering
Stack
  • Cloudflare Workers
  • KV, D1
Status
Worker live; app integration pending
Since
2025 to present
  1. Route send visitors towards the app, store or website
  2. Connect match installs to campaigns when a click ID is available
  3. Record acknowledge saved events and deduplicate identified retries

Keep the journey connected after someone taps.

Al Hatab sends links through messages, campaigns, packaging and its website. A visitor might have the app installed, need the store listing or be using a desktop browser. The destination needs to suit that situation.

The business also needs to understand which campaigns bring people into the app. We built routing and tracking together, on a link domain and infrastructure the client controls.

Give each visitor a useful next step.

The Worker handles install, referral, promotion, store, product, category and web-to-app links. It records campaign context and chooses a response for the device: a page that attempts to open the app and offers a store link, or a destination on the website. A matching click can later connect an installation to its campaign.

The production configuration below is abridged to show the storage bindings and privacy settings.

wrangler.toml
[[env.production.kv_namespaces]]
binding = "MOBILE_ATTRIBUTION"        # clicks, 30-day window

[[env.production.d1_databases]]
binding = "DB"                        # clicks, installs, events, identities: kept

[env.production.vars]
ANONYMIZE_IP = "true"                 # masked; set IP_SALT for a salted hash
ATTRIBUTION_TTL_SECONDS = "2592000"

The service also publishes the domain configuration used by iOS Universal Links and Android App Links. Following a visitor through an app-store installation is not guaranteed. If an install arrives without a matching click ID, it is recorded as organic. Verification on installed devices remains part of the app rollout.

Connect earlier activity when someone signs in.

The app can send an anonymous identity with installation and activity events. After sign-in, it supplies the customer identity to the Worker, which links the two and updates earlier install and event records. This gives campaign reporting a way to connect those stages. The updated mobile integration still needs to be released and verified.

Make saved events distinguishable from attempted delivery.

The event endpoints acknowledge database persistence and recognise retries that retain a stable event ID. Testing and staging use development storage; production has separate storage. IP masking is enabled in the recorded configuration, with salted hashing available. Identity records can include customer contact fields supplied by the app. Forwarding to Google Analytics is best effort, separate from the database acknowledgement.

On 19 September 2026, a staging benchmark saved 10,000 unique events and checked every event ID in the database. Replaying 1,000 events added no duplicate rows, and all 432 requests returned the expected acknowledgements. The test data was removed and cleanup verified. This established the result for that bounded test, not sustained production capacity or successful delivery to Google Analytics.

A focused service in the client’s account.

One Cloudflare Worker and two storage services hold the routing rules, click history and event records. The client controls the domain and infrastructure. This keeps the implementation focused on Al Hatab’s journeys while fitting beside its website, rewards area and mobile app.

The reliability changes were deployed to production on 19 September 2026 after staging validation. The updated mobile client has not yet been released, and installed-device link checks remain pending. The case study separates that remaining rollout work from the Worker tests already completed.

Next12Digital platform 2025Al Hatab Foods: a bilingual platform the content team runs

A bilingual content platform for Al Hatab Foods. Editors build pages, maintain the food catalogue and manage store details in Craft CMS, with shared content also available to the mobile app.

All work