Skip to main content
All CollectionsEmbedFormsGetting started
How to embed my form as a JS Trigger
How to embed my form as a JS Trigger

How can I embed my form as a JS trigger?

Didi avatar
Written by Didi
Updated over a year ago

You would like to embed your form on your website as a Js Trigger? Please follow the next steps below in order to embed the form as a JS trigger on your website.

If you still don't have an account for EmbedForms, click to start a 7-day trial.

TL;DR - Quick guide:

  1. Create your EmbedForms account

  2. Create and customize your form

  3. Create a widget

  4. Now you are ready to embed your form as a JS trigger

Follow the steps below for a detailed explanation:

1. Navigate to the 'Forms' tab, click 'Create form' and select one of the templates we have or you can create and customize your form from scratch:

Creating form from scratcjh or selecting one of the templates

2. Once you have created and customized the form, navigate to the 'Widgets' tab and click create widget and select the form from which you would like to create a widget. On the widget on the left menu select JS Trigger:

Creating widget and selecting JS Trigger

3. Define trigger ID:

Cupying the widget code

4. Copy widget code:

Copying the widget code

Once you have your widget code, you can just copy the code below:

<style>
.button {
font-weight: 500;
font-size: 20px;
padding: 1rem;
border-radius: 10px;
background-color: blue;
border: none;
color: #FFFFFF;
}
}</style><button class="button" id="Add the ID that you have added on your form"> <b> Leave a review </b></button>
//Widget code here

On the section id="Add the ID that you have added on your form" you will need to add the same Id you added on your form, here is how it should look:

id="#formJsTrigger"

And on the section //Widget code here you should place your widget code.

This is how the final code should look:

<style>.button {font-weight: 500;font-size: 20px;padding: 1rem;border-radius: 10px;background-color: blue;border: none;color: #FFFFFF;}}</style><button class="button" id="formJsTrigger"> <b> Leave a review </b></button><div class="embedsocial-forms-iframe" data-ref="38fd80e47cd71d1ffc657839ac7052d00584a222" data-widget="true" data-height="auto"></div><script>(function(d, s, id){var js; if (d.getElementById(id)) {return;} js = d.createElement(s); js.id = id; js.src = "https://embedsocial.com/cdn/ef.js"; d.getElementsByTagName("head")[0].appendChild(js);}(document, "script", "EmbedSocialFormsScript"));</script>

That's it! Once you have this code you can embed it on your website, a button will appear and once someone clicks on it they will be redirected on the created form.

Please note that you can customize the design of the button as you would like, this part of the code is totally customizable:

<style>
.button {
font-weight: 500;
font-size: 20px;
padding: 1rem;
border-radius: 10px;
background-color: blue;
border: none;
color: #FFFFFF;
}

If you have any questions, click the bottom right chat icon to talk with our customer success team or send us an email at support@embedsocial.com

We're here for you 🙏

Did this answer your question?