Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Google marking PostHog code remotely "hosted code" for chrome extension. #24965

Closed
Sachin-Malik opened this issue Sep 13, 2024 · 1 comment
Closed

Comments

@Sachin-Malik
Copy link

Bug Description

Bug description

So I have a extension (published on chrome WebStore) .The extension itself is a quick video (screen/camera) recorder. and I am using PostHog to collect user events. in my last release I updated the PostHog version
from 1.105.7 -> 1.154.1

I am using Javascript offering of PostHog, and sending these event from browser/client.

and for this release I got a warning from the Chrome WebStore team, indicating that I am using remotely "hosted code".
So a little context, I am using Manifest V3, for said extension, and in V3, every piece of code that want to use needs to be bundled with the extension itself. hence the no "Hosted code" allowed.

export const initPosthog = (user: User): void => {
  const posthogKey = isInternalUser(user.email) ? POSTHOG_API_KEY_INTERNAL : POSTHOG_API_KEY;
  if (!posthogKey) return;
  posthog.init(posthogKey, {
    ui_host: 'https://app.posthog.com',
    api_host: 'https://<posthog_api_host>/ingest',
    loaded(posthog_instance) {
      if (user) {
        posthog_instance.identify(user.user_id, {
          email: user.email,
          origin: 'extension'
        });
        posthog_instance.opt_in_capturing();
        posthog_instance.capture('user', {
          property: {
            'User ID': user.user_id,
            Name: user.name,
            Email: user.email
          }
        });
      }
    }
  });
};

I am sending these events to my to a Next App which is <postho_api_host/>, which simply redirects these events to PostHog, I am doing these to avoid these being denied/blocked by adblockers

const nextConfig = {
  nx: {
    svgr: false
  },
  async rewrites() {
    return [
      {
        source: "/ingest/:path(.*)",
        destination: "https://app.posthog.com/:path*",
      },
    ];
  }
};

If anyone have faced similar issue, It would love to listen from you. Please let me know if there is any more piece of information, that any one thinks could clear it further for readers.

Debug info

No response

@Sachin-Malik Sachin-Malik added the bug Something isn't working right label Sep 13, 2024
@pauldambra pauldambra removed the bug Something isn't working right label Sep 20, 2024
@pauldambra
Copy link
Member

duplicate of PostHog/posthog-js#1394 I'll close this so we can keep that issue as the canonical one for this problem

(thanks for reporting it)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants