0

List clicked nodes

by
Published Oct 17, 2025

Retrieve a collection of RRWeb DOM node-ids and the timestamp they were clicked.

Script sentry Verified

The script

Submitted by hugo697 Bun
Verified 235 days ago
1
//native
2
/**
3
 * List clicked nodes
4
 * Retrieve a collection of RRWeb DOM node-ids and the timestamp they were clicked.
5
 */
6
export async function main(
7
	auth: RT.Sentry,
8
	project_id_or_slug: string,
9
	replay_id: string,
10
	cursor?: string | undefined,
11
	environment?: string | undefined,
12
	per_page?: string | undefined,
13
	query?: string | undefined
14
) {
15
	const url = new URL(
16
		`https://${auth.region}.sentry.io/api/0/projects/${auth.organizationSlug}/${project_id_or_slug}/replays/${replay_id}/clicks/`
17
	)
18
	for (const [k, v] of [
19
		['cursor', cursor],
20
		['environment', environment],
21
		['per_page', per_page],
22
		['query', query]
23
	]) {
24
		if (v !== undefined && v !== '') {
25
			url.searchParams.append(k, v)
26
		}
27
	}
28
	const response = await fetch(url, {
29
		method: 'GET',
30
		headers: {
31
			Authorization: 'Bearer ' + auth.token
32
		},
33
		body: undefined
34
	})
35
	if (!response.ok) {
36
		const text = await response.text()
37
		throw new Error(`${response.status} ${text}`)
38
	}
39
	return await response.json()
40
}
41