PostHog not capturing App Bridge modals or their actions – any solution?

We’re using PostHog for analytics in our Shopify app, but we’ve noticed that session recordings do not capture anything happening inside Shopify App Bridge modals (including user actions such as button clicks).

We even tried wrapping the modal component with posthogInitWrapper, but that didn’t help.

  • Has anyone else run into this issue where App Bridge modals are invisible to PostHog session recordings?
  • Is there a workaround or recommended approach to track user actions inside these modals?
  • Do we need to use a different strategy (like custom event tracking) instead of relying on session recordings?

Any insights or examples would be really helpful!
this is the function we are using:

function PostHogInitWrapper({ children }) {
  const [userEmail, setUserEmail] = useState(null);

  useEffect(() => {
    api.shopifyShop
      .findFirst()
      .then((shop) => {
        setUserEmail(shop.email || "");
      })
      .catch(() => {
        setUserEmail("");
      });
  }, []);

  if (userEmail === null) {
    return null;
  }

  const disableRecording = noSessionEmails.includes(userEmail);

  return (
    <PostHogProvider
      apiKey={process.env.GADGET_PUBLIC_REACT_APP_PUBLIC_POSTHOG_KEY}
      options={{
        api_host: process.env.GADGET_PUBLIC_REACT_APP_PUBLIC_POSTHOG_HOST,
        session_recording: {
          blockClass: "ph-no-capture",
          maskAllText: false,
        },
        capture_pageview: false,
        enable_recording: true,
        disable_session_recording: disableRecording,
      }}
    >
      {children}
    </PostHogProvider>
  );
}
2 Likes

Browser side JS event reporting are subject to ad blocker extensions.

Additionally, if you haven’t configured Posthog JS to explictly not use cookies then the SDK can’t work properly. The AppBridge doesn’t allow cookie storage in brower.

I would recommend server side tracking in general, it’s much more reliable.

Getting the exact behavior on my end, I also left a comment in Posthog’s docs about this but no reply yet.

Really keen to know if someone has figured this one out already.

I’m seeing the same behavior on my end, has anyone found a solution?

Also seeing the same issues. Anyone found a fix yet?

@muchisx can you share how you got it working? in my case it’s getting “ERR_BLOCKED_BY_CLIENT……App Bridge”

didn’t wanted to fiddle too much so just went ahead with the OpenReplay and it’s working fab for me.