@m13v/seo-components 0.41.1 → 0.41.2
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/package.json
CHANGED
|
@@ -143,6 +143,13 @@ export function createDmShortLinkRedirectHandler(config: DmShortLinkRedirectConf
|
|
|
143
143
|
let replyId: number | null = null;
|
|
144
144
|
let project: string | null = null;
|
|
145
145
|
let platform: string | null = null;
|
|
146
|
+
// Newsletter rail attribution: the resolver returns broadcast_id +
|
|
147
|
+
// broadcast_product + recipient_email_hash when the code resolves to
|
|
148
|
+
// newsletter_links. We fire `newsletter_short_link_clicked` so PostHog
|
|
149
|
+
// can stitch the click back to the originating broadcast + recipient.
|
|
150
|
+
let broadcastId: number | null = null;
|
|
151
|
+
let broadcastProduct: string | null = null;
|
|
152
|
+
let recipientEmailHash: string | null = null;
|
|
146
153
|
|
|
147
154
|
try {
|
|
148
155
|
const params = new URLSearchParams();
|
|
@@ -169,6 +176,9 @@ export function createDmShortLinkRedirectHandler(config: DmShortLinkRedirectConf
|
|
|
169
176
|
reply_id?: number;
|
|
170
177
|
project?: string;
|
|
171
178
|
platform?: string;
|
|
179
|
+
broadcast_id?: number;
|
|
180
|
+
broadcast_product?: string;
|
|
181
|
+
recipient_email_hash?: string;
|
|
172
182
|
};
|
|
173
183
|
if (body.target_url) {
|
|
174
184
|
target = body.target_url;
|
|
@@ -177,6 +187,9 @@ export function createDmShortLinkRedirectHandler(config: DmShortLinkRedirectConf
|
|
|
177
187
|
replyId = body.reply_id ?? null;
|
|
178
188
|
project = body.project ?? null;
|
|
179
189
|
platform = body.platform ?? null;
|
|
190
|
+
broadcastId = body.broadcast_id ?? null;
|
|
191
|
+
broadcastProduct = body.broadcast_product ?? null;
|
|
192
|
+
recipientEmailHash = body.recipient_email_hash ?? null;
|
|
180
193
|
}
|
|
181
194
|
}
|
|
182
195
|
} catch (err) {
|
|
@@ -248,6 +261,34 @@ export function createDmShortLinkRedirectHandler(config: DmShortLinkRedirectConf
|
|
|
248
261
|
);
|
|
249
262
|
}
|
|
250
263
|
|
|
264
|
+
// Newsletter rail event. distinct_id is the recipient_email_hash so
|
|
265
|
+
// every click from the same recipient stitches under one identity in
|
|
266
|
+
// PostHog. Properties carry broadcast_id + product so HogQL queries
|
|
267
|
+
// can attribute clicks (and downstream signup events on the same
|
|
268
|
+
// session) back to a specific broadcast x recipient pair.
|
|
269
|
+
if (!isBot && target && posthogKey && broadcastId != null) {
|
|
270
|
+
fetch(`${posthogHost}/i/v0/e/`, {
|
|
271
|
+
method: "POST",
|
|
272
|
+
headers: { "Content-Type": "application/json" },
|
|
273
|
+
body: JSON.stringify({
|
|
274
|
+
api_key: posthogKey,
|
|
275
|
+
event: "newsletter_short_link_clicked",
|
|
276
|
+
distinct_id: recipientEmailHash || `newsletter_${broadcastId}`,
|
|
277
|
+
timestamp: new Date().toISOString(),
|
|
278
|
+
properties: {
|
|
279
|
+
broadcast_id: broadcastId,
|
|
280
|
+
broadcast_product: broadcastProduct,
|
|
281
|
+
recipient_email_hash: recipientEmailHash,
|
|
282
|
+
project,
|
|
283
|
+
code,
|
|
284
|
+
site,
|
|
285
|
+
},
|
|
286
|
+
}),
|
|
287
|
+
}).catch((err) =>
|
|
288
|
+
console.error("[dm-short-link/redirect] posthog fetch failed:", err)
|
|
289
|
+
);
|
|
290
|
+
}
|
|
291
|
+
|
|
251
292
|
return Response.redirect(target || homeUrl, 302);
|
|
252
293
|
};
|
|
253
294
|
}
|
|
@@ -15,7 +15,7 @@ import { discoverGuides } from "./discover-guides";
|
|
|
15
15
|
import { logAiUsage } from "./ai-usage";
|
|
16
16
|
|
|
17
17
|
const MODEL_ID = "gemini-flash-latest";
|
|
18
|
-
const MAX_TOOL_ROUNDS =
|
|
18
|
+
const MAX_TOOL_ROUNDS = 50;
|
|
19
19
|
const RATE_LIMIT_MAX = 20;
|
|
20
20
|
const RATE_LIMIT_WINDOW_MS = 60 * 60 * 1000;
|
|
21
21
|
|