Skip to content

Investigate: external-link custom events (wallet click-through) fire unreliably — trackCustomEvent defers trackEvent to requestIdleCallback #18928

Description

@konopkja

Summary

Custom click events for external links (notably wallet external links on /wallets/find-wallet) appear to fire unreliably in production. When clicking a wallet's website/social icons, browser event inspectors (Omnibug) sometimes show only Matomo's automatic exitclick/outlink hit and no custom trackEvent — even though the links have customEventOptions set in source.

This is filed for investigation — the root cause below is a strong hypothesis, not yet confirmed live.

Observed

  • On production, clicking the expanded-card social/website icons on find-wallet fires only exitclick in Omnibug; the WalletExternalLinkList / Go to wallet custom event does not appear.

  • The behavior is nondeterministic: the main "Visit website" button (Tap main button) has been observed firing its custom event, while a social link in the same session did not.

  • Matomo data (site 4, last 30 days) under WalletExternalLinkList:

    • Tap main button: 14,629 events
    • Go to wallet: 349 events

    The Go to wallet (website + Discord + Twitter inside the expanded card) count looks implausibly low relative to the main button, consistent with those events being dropped.

Root-cause hypothesis (needs confirmation)

trackCustomEvent defers the trackEvent push into requestIdleCallback:

// src/lib/utils/matomo.ts
scheduleIdleCallback(() => {
  push(['setCustomUrl', currentUrl])
  push(['trackEvent', eventCategory, eventAction, eventName, eventValue])
})

External links render as <a target="_blank" …> (src/components/ui/Link.tsx, BaseLink external branch). Clicking one backgrounds the current tab, where requestIdleCallback is heavily throttled / may not run — so the deferred trackEvent is lost. Matomo's built-in outlink tracking (exitclick) is separate and synchronous, so it survives. Whether the idle callback fires before the tab loses focus is timing-dependent, which matches the nondeterministic behavior observed.

Affected code

  • src/lib/utils/matomo.tstrackCustomEvent (the scheduleIdleCallback deferral)
  • src/components/ui/Link.tsxBaseLink createClickHandler → external onClick
  • Find-wallet call sites: src/components/FindWalletProductTable/WalletSubComponent.tsx (social/website icons, Go to wallet), WalletInfo.tsx (main button, Tap main button)
  • The find-wallet rebuild in feat: rebuild find-wallet on the shared catalog (revamp PR 2) #18846 uses the same trackCustomEvent util (app/[locale]/wallets/find-wallet/@modal/(.)[wallet]/page.tsx, [wallet]/page.tsx), so it inherits the same behavior — the redesign does not fix or worsen this.

Impact

  • Any external-link custom event routed through trackCustomEvent (i.e. all BaseLink external clicks) may be under-reported, most visibly wallet external-link click-through — the primary success metric for the wallet finder.
  • Not a blocker for the planned find-wallet A/B test: both variations use the same util, so under-counting is symmetric across arms and the relative comparison stays valid; only the absolute conversion counts are understated.

How to verify

  1. Load https://ethereum.org/wallets/find-wallet/ in prod, open DevTools → Network, filter for the Matomo endpoint.
  2. Expand a wallet card, click a social/website icon, and check whether a trackEvent request (e_c=WalletExternalLinkList) actually leaves — compare when the click opens a new tab vs when navigation is prevented / same-tab.
  3. Repeat with the tab kept in the foreground vs immediately backgrounded to test the requestIdleCallback throttling theory.

Possible fixes to evaluate

  • Fire the trackEvent synchronously on click for external links (drop the requestIdleCallback wrapper for user-initiated click-throughs), or
  • Use a sendBeacon / keepalive transport so the hit survives navigation/backgrounding.
  • After a fix, compare the WalletExternalLinkList event volume before/after to quantify the recovered events.

Related

  • Analytics context: the Download a wallet goal (Matomo goal 1) matches event_action == "Go to wallet", which is only the rarely-clicked social links (~349/mo), not the main wallet click-through (Tap main button, ~14.6k/mo) — a separate goal-configuration issue worth flagging to whoever owns Matomo goals.
  • Find-wallet rebuild: feat: rebuild find-wallet on the shared catalog (revamp PR 2) #18846

Metadata

Metadata

Assignees

No one assigned

    Labels

    bug 🐛Something isn't workingdev requiredThis requires developer resources

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions