harthur90
Forum Replies Created
-
You should change your php code to the following:
function add_async_to_forms_script( $tag, $handle ) { if ( 'leadin-forms-v2' === $handle ) { $tag = str_replace( 'src', 'async src', $tag ); } return $tag; }
add_filter('script_loader_tag','add_async_to_forms_script'
)You can simplify you page code to the following:
<script> window.hsFormsOnReady = window.hsFormsOnReady || []; window.hsFormsOnReady.push(()=>{ hbspt.forms.create({ region: "na1", portalId: "8419634", formId: "d0de9b78-f8c6-4b96-b2fd-c2e78e483a5f", target: "#your-div-id", }) }); </script>
Our script already has the defer property and the logic to render forms after the script has been loaded – you are looking to add the async property instead
please note the code I sent was an example, you may need to adapt to work outside of a PHP class – which is the error you got
best regards
- This reply was modified 1 year, 8 months ago by harthur90. Reason: add additional information
A html will not work on this case. You can verify by checking if the script has the async property when inspecting the source code of the page
best regardsIt would work. but I would suggest having a folder created at plugins, eg. leadin-forms-async/leadin-forms-async.php
Similiar to what is done at https://plugins.svn.www.ads-software.com/leadin/trunk/public/class-pagehooks.php
you can have your own plugin that adds async to the forms script, with the following code:
add_filter( 'script_loader_tag', array( $this, 'add_async_to_forms_script' ), 10, 2 ); public function add_async_to_forms_script( $tag, $handle ) { if ( 'leadin-forms-v2' === $handle ) { $tag = str_replace( 'src', 'async src', $tag ); } return $tag; }
please note that this can affect forms that are loaded inside modals.
Closing this due to inactivity, feel free to re-open if needed.
Best regards,
Hi @cp1132 Thanks for your message.
This script is responsible for loading HubSpot forms at your page. We already defer this particular script at our plugin.
Are you using the latest version of the plugin? Also I would make sure if this script is not being manually added into any page.
Let me know if this helps,
Best regardsThanks for the reply with more information,
HubSpot emails will not be influenced by the fact WordPress is involved. The captured lead will first go to your HubSpot Portal then an email will be sent, so the source has no impact over the email sentLet me know if this answer your question.
Best Regards
Hi @sptopdesk, thanks for your message
Are you referring to you receiving emails when people submit a form on your website? if that is the case, you do not need a SMTP.
Best regardsHi @benfellah1992 I believe MainWP is filtering by the word “leadin” as none of those warnings relate to our plugin but all contain “leading” on their description
Best regards
- This reply was modified 1 year, 9 months ago by harthur90.
@tyrannous Thanks for closing the support thread. We do have plans to support the use of SVN tags. This should be done as part of our quarter priorities. If you do wish for a particular plugin version you can request them via email ??
Best Regards
Hi @tyrannous Thanks for your message. I’ll try to replicate and let you know once a fix is available! If you could send an email with your list of plugins and configuration (WP version, php version) to [email protected] this would help the process
Thanks in advance
Best regardsHi @name1user Thanks for your message,
When embedding a form you can specify a target element:
<script> hbspt.forms.create({ ..., target:"#your-container-element-id }); </script>
Advanced customization is restricted to the starter plan.
Related to your claim of data tracking please refer to our GDPR Guidelines. All our tracking is done anonymously and after user consent. We do not use the information your are claiming in any of our sales and support channels.Best regards
Hi @nvest
Its been a while since you replied to this thread.
I’ll close it due inactivity but feel free to re-open.
Best regards
Now released Version 9.0.500 has a validation that fixes the error
Best regards