(url: string)
| 18 | |
| 19 | // remove utm params, the most likely for us to be useless |
| 20 | function getCleanUrl(url: string): string { |
| 21 | const parsed = new URL(url); |
| 22 | |
| 23 | for (const param of Array.from(parsed.searchParams.keys())) { |
| 24 | if (param.startsWith("utm_")) { |
| 25 | parsed.searchParams.delete(param); |
| 26 | } |
| 27 | } |
| 28 | |
| 29 | return parsed.toString(); |
| 30 | } |
| 31 | |
| 32 | const findKeyInsight: NextApiHandler = async (req, res) => { |
| 33 | const { url } = req.body; |