1
0
mirror of synced 2025-12-29 18:00:57 -05:00

Merge branch 'main' into codespaces-universe-megabranch

This commit is contained in:
isaacmbrown
2022-10-31 09:51:06 +00:00
123 changed files with 3449 additions and 1842 deletions

View File

@@ -57,6 +57,7 @@ type SendEventProps = {
exit_visit_duration?: number
exit_scroll_length?: number
link_url?: string
link_samesite?: boolean
search_query?: string
search_context?: string
search_result_query?: string
@@ -255,11 +256,13 @@ function initCopyButtonEvent() {
function initLinkEvent() {
document.documentElement.addEventListener('click', (evt) => {
const target = evt.target as HTMLElement
const link = target.closest('a[href^="http"]') as HTMLAnchorElement
const link = target.closest('a[href]') as HTMLAnchorElement
if (!link) return
const sameSite = link.origin === location.origin
sendEvent({
type: EventType.link,
link_url: link.href,
link_samesite: sameSite,
})
})
}