Skip to content

Can't load load dead clicks or exception autocapture in browser extension #2828

@kirankunigiri

Description

@kirankunigiri

Bug Description

Followed the docs to setup posthog in a browser extension here: https://posthog.com/docs/advanced/browser-extension, but I'm seeing errors for loading dead clicks and exception autocapture. I'm using Vite with WXT.

This is what my code looks like:

import 'posthog-js/dist/web-vitals';
import 'posthog-js/dist/posthog-recorder';
import 'posthog-js/dist/exception-autocapture';
import 'posthog-js/dist/dead-clicks-autocapture';
import { PostHog, PostHogConfig } from 'posthog-js/dist/module.no-external';
import { PostHogProvider } from 'posthog-js/react';

const posthogOptions: Partial<PostHogConfig> = {
	api_host: import.meta.env.VITE_PUBLIC_POSTHOG_HOST,
	defaults: '2025-11-30',
	debug: import.meta.env.MODE === 'development',
	disable_external_dependency_loading: true,
	persistence: 'localStorage',
	disable_surveys: true,
	error_tracking: {
		captureExtensionExceptions: true,
	},
};

export const initPosthog = () => {
	const posthog = new PostHog();
	posthog.init(import.meta.env.VITE_PUBLIC_POSTHOG_KEY, posthogOptions);
	return posthog;
};

While this fixes errors with loading session recording, I'm still getting these errors for dead clicks + exception autocapture, even though I imported the exception-autocapture and dead-clicks-autocapture files. The fact that it does work for recording sessions but not the others makes me unsure if the issue is with my config or with PostHog.

[PostHog.js] [Dead Clicks] failed to load script Loading of external scripts is disabled
[PostHog.js] [ExceptionAutocapture] failed to load script Loading of external scripts is disabled

Am I missing anything in my config?

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions