Open gaelbonjour opened 4 years ago
Hi @gaelbonjour thanks for reaching out to us. If an ad blocker blocks fs.js
, you should still be able to call API functions from the SDK without throwing errors as long as you've called init
in your code before you invoke the API functions. The init
function creates the window[window._fs_namespace]
object and creates place holders for functions that can be invoked before fs.js
is loaded. An error is thrown only if window[window._fs_namespace]
doesn't exist when you try to call an API function.
Calling init
is the same as running the FullStory snippet in the <head>
of your markup. If you weren't using @fullstory/browser
from NPM and you attempted to call API functions without running the snippet in the head
, you'd also get errors when trying to call API functions.
Could you please verify that you're always calling API functions after the init
function is called?
We rely on Segment to load all the analytics and tracking tools, including Fullstory. We do not add snipets nor call init for each tools since segment is meant to do that dynamically.
However, if for some reason, fs.js or segment are blocked, it should not throw if fs is not ready when calling the various api. Alternatively, I should be able to know if Fullstory is ready so I can skip the calls to the APIs.
Hi, I'd like to track down exactly where you're seeing the exceptions and what kind of exceptions they are so that I'm sure to address your problem instead of assuming that I understand. Could you provide a quick snippet from your code where the exception is thrown and information from the JS console about which exception type it is? With that I can nail down what's happening and figure out a solution.
I know it's been some time since this was opened, but it still is an issue even in version 2.0.0
. When trying to init Fullstory in a SSR React App, the only valid method for initialization is within a useEffect()
, but then the reported issue occurs. So it's very confusing why the documentation would say this:
Before the FS script is fully bootstrapped, all calls to the client API are enqueued to be processed when capture has begun. Once capture has begun, calls to the client API are immediately processed.
Hi,
It happens some of our users use a tracker blocker, that blocks, Segment or Fullstory or both. Calling various api such as setUserVars should NOT throw an exception if FS si not initialized.
Current work arround : wrap every call to Fullstory API in try catch. If feels overkill for such a case
Expected behavior : Fullstory MAY warn in console, but since there is nothing more to be done to get fullstory to work if fs.js has been blocked.
Alternative behavior : Fullstory API could provide a "isInitialized" member, indicating wheather it is safe to call any other api functions.