Embeds in a Wix

I’d like to use the following to embed onto a Wix page:

<script src="https://api.mncompass.org/compass.min.js"></script>
<script>
  w = document.querySelector('.HtmlComponentElement').clientWidth - 40 || 680;
  wilder.compass.embed("b15310-1", { 'width': w, 'api': 'api.mncompass.org' });
</script>

I’ve tried several approaches including the Velo API, 3rd party backend, custom elements, and just straight into an html element. None have worked.

This works outside of Wix. Why is it so hard with a Wix web page?

Product:
Wix Website Editor

What are you trying to achieve:
Ideally, I’d like to embed a table onto the page of a Wix site.

What have you already tried:
Wix Html Component, [Velo API’s Custom Element], [Third-party services with the Fetch API], and Custom Element with Third-party services with the Fetch API combined.

Additional information:
Here’s an example of the embed working outside of a Wix context.

You can use your browser’s dev tools to see the script tags at work in the page’s HTML.

Hey! You are really close. Using the HTML component you need to remove this line of code from your script:

w = document.querySelector('.HtmlComponentElement').clientWidth - 40 || 680;

Then in the line below, you can set the width to whatever you want it to be, you will not be able to calculate it in the script as you cannot access the iFrame element class via querySelector in the Wix environment.