Skip to main content

Hey everyone,
I’ve been testing a custom React component on a Figma Site (built with Figma’s new code components / figma:react), and I’m having trouble tracking clicks with Google Analytics 4 (GA4).

Here’s what I’ve done so far:

  1. Added my GA4 Measurement ID (e.g. G-XXXXXXX) in Site settings → Analytics

  2. Confirmed that the gtag script is loading properly (I can see gtag() in the console)

  3. Added a simple component that fires an event on click:

    if (window.gtag) { window.gtag("event", "cta_button_click", { content_type: "cta_button", button_text: "Get Started", }); }

  4. The console shows the log correctly on click,
    but nothing appears in GA4 → Realtime → Events or DebugView.

It feels like the event is being called in a sandboxed context where analytics can’t actually send data out — maybe due to how Figma Sites handle scripts or iframes?

Has anyone managed to successfully track custom GA4 events inside Figma Sites yet?
If yes, how did you make it work? (Any tricks with global window, site analytics setup, or custom script injection?)

Thanks in advance 🙏
Would love to get GA4 working properly inside Figma Sites — analytics are crucial for testing engagement.

Be the first to reply!