Skip to content

Conversation

@yosriady
Copy link
Contributor

Attempt to fix https://linear.app/getformo/issue/P-956/formo-browser-installation-does-not-work-on-some-websites by removing the environment variable and some dependencies

@linear
Copy link

linear bot commented Feb 13, 2025

P-956 Formo Browser Installation does not work on some websites

When you install the following snippet on a website (try on a dummy website you have yourself)

  console.log('Starting Formo snippet');
  
  var script = document.createElement('script');
  var apiKey = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJvcmlnaW4iOiJodHRwczovL3lvcy5pbyIsInByb2plY3RfaWQiOiJqODlfS0pZdmVaVVFpWG5fb0REajYiLCJpYXQiOjE3Mzk0MjYzOTB9.t19W7R3-ZIzdy9QJEACuGIwFkV0bhZHJJikvHiS4p04';

  script.src = 'https://unpkg.com/formo/analytics';
  script.onload = function () {
    console.log('onload FormoAnalytics');
    console.log(FormoAnalytics);
    FormoAnalytics.init(apiKey)
      .then(function(formo) {
        console.log('Formo post init');
        window.formo = formo;
      })
      .catch(function(error) {
        console.error('Error initializing FormoAnalytics:', error);
      });
  };
  console.log('Appending child');
  document.head.appendChild(script);
  console.log('End Formo snippet');

FormoAnalytics is undefined for some reason and the SDK fails to initialize

Screenshot 2025-02-13 at 16.18.46.png

process is not defined could be the problem?

@yosriady yosriady requested a review from TamHuynhTee February 13, 2025 09:34
@yosriady yosriady merged commit 141b537 into main Feb 13, 2025
3 checks passed
@yosriady yosriady deleted the hotfix/highlight branch February 13, 2025 09:38
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

Successfully merging this pull request may close these issues.

3 participants