@affiliateo/web 4.6.1 → 4.7.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/provider.js CHANGED
@@ -280,6 +280,18 @@ export function AffiliateoProvider({ appId, campaignId, apiUrl, allowedHostnames
280
280
  visitor_id: vid,
281
281
  session_id: getSessionId(),
282
282
  event_name: name,
283
+ // Page context, same three fields the pageview sender carries.
284
+ // A goal event used to go out without them, and the server's
285
+ // `path || hostname || '[Web]'` fallback then overwrote the
286
+ // visitor's real current_page with the literal string '[Web]' —
287
+ // which both broke the tracking-page popover and made the visitor
288
+ // invisible to any funnel step matching on a page path. The server
289
+ // no longer clobbers on missing values, but sending the real path
290
+ // is what actually keeps current_page correct as a visitor fires
291
+ // goals while navigating a single-page app.
292
+ url: window.location.href,
293
+ path: window.location.pathname,
294
+ hostname: window.location.hostname,
283
295
  };
284
296
  if (metadata && typeof metadata === 'object')
285
297
  payload.metadata = metadata;
package/dist/queue.js CHANGED
@@ -120,10 +120,27 @@ export class EventQueue {
120
120
  enqueue(endpoint, payload) {
121
121
  if (this.shuttingDown)
122
122
  return;
123
+ const id = uuid();
123
124
  this.queue.push({
124
- id: uuid(),
125
+ id,
125
126
  endpoint,
126
- payload,
127
+ // Delivery metadata is baked into the PERSISTED payload rather than
128
+ // added at flush time, so every retry — and every recovery after a
129
+ // page reload — sends a byte-identical body:
130
+ //
131
+ // event_id makes the server insert idempotent. Without it, a 5xx
132
+ // raised after the row was already written, or a network timeout
133
+ // on a request the server actually processed, lands the same
134
+ // event twice: flush() only removes an entry on res.ok, so
135
+ // anything else bumps retries and sends it again (MAX_RETRIES=3).
136
+ // The server dedups on this via a unique index.
137
+ //
138
+ // client_ts is when the event HAPPENED. The server used to stamp
139
+ // arrival time, but the 5s flush cadence, the size-threshold
140
+ // burst flush, and retries all reorder delivery freely — so
141
+ // arrival order is not user order. Stamping at enqueue is the
142
+ // only point that still knows the real sequence.
143
+ payload: { ...payload, event_id: id, client_ts: Date.now() },
127
144
  retries: 0,
128
145
  });
129
146
  // FIFO drop when over cap. Network outage edge case: if we're way
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@affiliateo/web",
3
- "version": "4.6.1",
3
+ "version": "4.7.0",
4
4
  "description": "Affiliateo web SDK \u2014 affiliate attribution and tracking for web apps",
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/index.js",