PostHog / posthog

🦔 PostHog provides open-source web & product analytics, session recording, feature flagging and A/B testing that you can self-host. Get started - free.
https://posthog.com
Other
21.88k stars 1.31k forks source link

Some videos recording, but others aren't #25499

Open Nazkab10 opened 1 month ago

Nazkab10 commented 1 month ago

Bug Description

Bug description

We aren't able to capture recordings for some users, but for others we do. It seems extremely random and we're not sure why. When I tried to troubleshoot and type window.posthog.LIB_VERSION in the console it returned undefined, which is strange because it was recording for me. I also updated my package to the latest available one as per the instructions on posthog. The fact that it is at least recording suggests that it is set up correctly, but I'm still confused as to why it would return undefined in the console. Thanks!

The link to the site is alorapodcasts.com.

How to reproduce

  1. go to alorapodcasts.com
  2. it may or may not record the user session. For some users it does and others it doesn't
Screenshot 2024-10-09 at 19 12 44

Additional context

Debug info

Session: https://us.posthog.com/project/sTMFPsFhdP1Ssg/replay/01927409-6815-7612-824c-f01b19150a77?t=3227
Admin: http://go/adminOrgUS/019202cb-0e34-0000-6176-37cc0349467d (project ID 91669)
Sentry: http://go/sentryUS/91669
pauldambra commented 1 month ago

We aren't able to capture recordings for some users, but for others we do. It seems extremely random and we're not sure why.

Hey, how do you know you're not capturing?

You do have min duration set to 10 seconds... Could it be that?

Nazkab10 commented 1 month ago

nope, I've seen users interact with the app for longer than 10 and it still won't appear. My friend onboarded, but nothing was captured by posthog. Whereas posthog always catches what I'm doing

Here is the main.jsx file for reference

import { StrictMode } from "react";
import { createRoot } from "react-dom/client";
import { ChakraProvider, extendTheme } from "@chakra-ui/react";
import { BrowserRouter } from "react-router-dom";
import App from "./App.jsx";
import { PostHogProvider } from "posthog-js/react";
import "./index.css";

const options = {
  api_host: import.meta.env.VITE_POSTHOG_HOST,
};

const styles = {
  global: {
    body: {
      bg: "#121212",
    },
  },
};

const config = {
  initialColorMode: "dark",
  useSystemColorMode: false,
};

const theme = extendTheme({ config, styles });

createRoot(document.getElementById("root")).render(
  <StrictMode>
    <PostHogProvider
      apiKey={import.meta.env.VITE_POSTHOG_KEY}
      options={options}
    >
      <ChakraProvider theme={theme}>
        <BrowserRouter>
          <App />
        </BrowserRouter>
      </ChakraProvider>
    </PostHogProvider>
  </StrictMode>
);
Nazkab10 commented 1 month ago

Also, nice to meet you. Always great to meet a fellow manc lol

pauldambra commented 3 weeks ago

I'll assume you've ruled out things like the key sometimes not being present in the environment because you're seeing events (but mention it for completeness since I've seen computers disappoint us all so many times 🤣 )

Are you using a reverse proxy? Am wondering if sometimes the recorder script doesn't load or the traffic is too large to get through 🤔

It's really tricky to debug absence... do you have other tools that might capture console logs or errors that would help diagnose?

(sorry to be vague...)