# RDT — tracking links on each sending server

| File | What it does |
|---|---|
| `controller.php` | Routing click/unsubscribe links (`/<s>ab<e>..<i>rr`): records the event, redirects to the offer or its unsubscribe page. |
| `o.php` | Routing open pixel (`/<s>xx<e>..=<sender>`): records the open, shows the 1x1 image. |
| `go.php` | Encrypted (`/t/<token>`) and attribute (`/RDT/go.php?a=c&s=..`) links, and the AWS S3 / CloudFront ones once forwarded. |
| `tracking_lib.php` | Appends events to `/var/lib/limitless/events/<day>.csv` and asks the master (`Send/trackRoute.php`) on every click where a send's clicks go, so the offer's saved Link/Unsub always win; `/var/lib/limitless/routes/` keeps the last answer only for when the master is unreachable. `tracking_offer_target()` builds the click target (below). |

The server has no database: the master downloads the events (`exactarget/Send/getEvents.php`, command `pmta:fetch-events`).
Build creates the folders, the `/t/` rewrite rule and `includes/master.php`.

## Where a click goes (`tracking_offer_target`)

The offer link carries mailer / send / email so the network's report says which mailer and send a lead came from
(`pmta:sync-cake`, `pmta:sync-everflow` read it back into `cake_stats`):

| Offer's sponsor platform (master answers `subs`) | Click goes to |
|---|---|
| Everflow (`subs: everflow`) | `<link>?sub1=<mailer>&sub2=<send>&sub3=<email id>`; other parameters on the link are kept, `sub1`-`sub3` already on it are replaced. |
| Cake, HitPath, anything else, or an answer without `subs` (older master, cached route) | `<link><mailer>/<send>/<email id>`, as always. |

A sending server gets new RDT code only through `sudo ops/deploy.sh --sync-bundle` followed by **Build Config** on that server.
Until then it keeps appending the path for every offer: Everflow clicks still redirect, they just are not counted per mailer.
