> For the complete documentation index, see [llms.txt](https://foodcommerce-api-help.onlinesales.ai/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://foodcommerce-api-help.onlinesales.ai/user-tracking-events/js-sdk/common-errors.md).

# Common Errors

## Function is undefined

![Uncaught Reference Error](https://3436271813-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FzYWyAefu1lmcv8DuOgMN%2Fuploads%2F2QKajks9v6zRtQJ54cMl%2Fimage.png?alt=media\&token=02cb43a3-8b82-4089-b4ce-3852ef3ee1e7)

This issue can occur for one of the following reasons

* the [base code](/user-tracking-events/js-sdk/installing-the-tag.md#base-code) is not loaded on the website
* the function is called while the base code is being loaded

### Resolution

You have to wait until our functions completely loaded on your website before calling mentioned functions.

One of the possible implementations could be

```javascript
(function(){  
    var interval = setInterval(function() {
       if("undefined" !== _osSaleComplete){
           clearInterval(interval);
           _osSaleComplete(_osProductObj); // function to be invoked
       }
    }, 500);
})();
```
