Overview
DojoMojo's JavaScript snippet for Signup Forms enables custom forms to appear on your website. The snippet is manually installed, allowing fo greater flexibility of placement and troubleshooting if page load speeds are impacted.
Improving page load performance using different script loading techniques
If you find that DojoMojo's JavaScript is impacting your website’s performance (e.g. PageSpeed score), there's a few things you can try, including the placement of the snippet or simply adding a word to the snippet.
1. Script in <head> tag
When your Signup Form's JavaScript snippet is placed within the <head> of your site, the form will load before the HTML in the <body> section of your site.
2. Script at the bottom of the </body> tag
When the snippet is placed just before the closing </body> tag, your form will start to load after all the page content is rendered. Your site loads tags one by one, so this technique helps ensure the page renders quickly.
3. Script in <head> with async attribute
<script src=“index.js” async />
DojoMojo’s JavaScript will be loaded asynchronously. This means it will not block other aspects of your site from loading. With this technique, what loads first, runs first.
For this approach, add async right before the end of the opening tag of your snippet. Your snippet should look something like this:
<script data-dojomojo-id="1238" src="http://localhost:3003/sign-up.js" async></script>
4. Script in <head> with defer attribute
<script src=“index.js” defer />
Similar to option 3, DojoMojo’s JavaScript will be loaded asynchronously. With this technique, order of execution is preserved based on the tag order on your page.
For this approach, add defer right before the end of the opening tag of your snippet. Your snippet should look something like this:
<script data-dojomojo-id="1238" src="http://localhost:3003/sign-up.js" defer></script>
Options | Snippet | Placement |
1. Script in <head> tag | <script src=“index.js” /> | Inside <head> |
2. Script at the bottom of the <body> tag | <script src=“index.js” /> | Before </body> |
3. Script in <head> with async attribute | <script src=“index.js” async /> | Inside <head> |
4. Script in <head> with defer attribute | <script src=“index.js” defer /> | Inside <head> |
Please note that Google’s PageSpeed Insights and other site speed reports may still flag your signup form as a contributing factor in your site’s load times. Site speed and SEO are important to our customers, and DojoMojo is committed to minimizing the impact from our JavaScript. You will automatically see improvements as we release new updates.