[dyad] Improve HubSpot detection logic - wrote 1 file(s)

This commit is contained in:
[dyad]
2026-01-21 08:33:37 +01:00
parent 3302d7f2f8
commit 450f5f0614

View File

@@ -302,10 +302,18 @@ export async function extractMetaData(url: string, keyword?: string) {
let hotjarMatch = htmlContent.match(/hjid:(\d+)/); let hotjarMatch = htmlContent.match(/hjid:(\d+)/);
if (hotjarMatch) uniqueTrackers.set("Hotjar", hotjarMatch[1]); if (hotjarMatch) uniqueTrackers.set("Hotjar", hotjarMatch[1]);
let hubspotMatch = htmlContent.match(
/js(?:-[a-zA-Z0-9]+)?\.hs-scripts\.com\/(\d+)\.js/ // HubSpot (scan script tags)
); $('script[src]').each((i, el) => {
if (hubspotMatch) uniqueTrackers.set("HubSpot", hubspotMatch[2] || hubspotMatch[1]); const src = $(el).attr('src');
if (src && src.includes('.hs-scripts.com/')) {
const match = src.match(/(\d+)\.js$/);
if (match && match[1]) {
uniqueTrackers.set("HubSpot", match[1]);
return false; // Stop iterating once found
}
}
});
const detectedTracking: TrackingTool[] = Array.from( const detectedTracking: TrackingTool[] = Array.from(
uniqueTrackers, uniqueTrackers,