How to connect a call quiz javascript (Dialogue option)

Hi experts :slight_smile:
Can you please tell me how to add java script execution by pressing a button?
A third party service gave me this code:

Code to call quiz (Dialogue version)

To call the dialogue you need one of two things:

  • Replace YourButtonId with the ID of the button that will open the quiz window
  • Specify the link for the button: #quiz_vasszsj

I’m a noob, so could you give me a step-by-step guide, how to connect?
#javascript

Add an html iframe to your page and paste that code into it.

Add a button and call it whatever you want and then place the name of the button into the code.

Hah)) it would be too easy)) I have already tried it, but it does not work

Well it seems that you only gave us half the info.

You can build it into the site without a button or through a button link and it does give you two versions of the code.

It does say on the instructions that you need to enter code into the head section too.
Something like this:

<script type="text/javascript" src="https://show.enquiz.io/js/quizloader.js"></script>

To do that you will need to add a new tool in tracking and analytics and make sure that you place it into the head section.

Then you can add your code again without button parts for built into site:
CHECK THIS IS CORRECT FROM YOUR SUPPLIED CODE:

<script>
(function () {
new enquiz_ioLoader({
quiz_hash:"vasszsj",
})
})()
</script>

Or add your full code as before for your button version:
CHECK THIS IS CORRECT FROM YOUR SUPPLIED CODE:

<script>
             (function () {
                 new enquiz_ioLoader({
                     quiz_hash:"vasszsj",
                     type: enquiz_ioLoader.FLOAT,
                     button: "YourButtonId",
                     hash: "quiz_vasszsj"
                 })
             })()
</script>

And add a button for it and make sure that your button id name in the properties panel matches exactly the button id that you insert into the code.

So for example, if your button is called button24 or quizButton, then button24 or quizButton must be added to the code

I tried to add into to the head:

<script type="text/javascript" src="https://show.enquiz.io/js/quizloader.js"></script>

(This code also gave me a third-party service:
"1. Initialization code (Paste this code into the <head> block at the top of the page)" )

2b. Or add it to any place, for the Dialog option, replace YourButtonId with the button id, calling the quiz window

<script>
      (function () {
          new enquiz_ioLoader({
              quiz_hash:"vasszsj",
              type: enquiz_ioLoader.FLOAT,
              button: "buttonid",
              hash: "quiz_vasszsj"
          })
      })()
</script>

I added a button to the page and called it id “buttonid”, but still nothing works.

I think maybe need to add some code to the backend and call it through wix code?
But I don’t know how to do it, what exactly needs to be written in this code