- This topic has 22 replies, 5 voices, and was last updated 9 months ago by Fernando.
January 18, 2019 at 2:10 am #785305Marga
Thank you very muchJanuary 18, 2019 at 4:41 am #785400DavidStaffCustomer Support
you can use the Hook Element:
Create a new Hook add your script, and select the after_footer hook and then assign the display rules for Entire Site ( or selected pages ) for where you want the script to run.March 4, 2022 at 8:35 am #2142411Margaret
To run the <script> with minimal effect on pagespeed, where should it be placed?March 4, 2022 at 8:43 am #2142419DavidStaffCustomer Support
If possible you would ideally want to add the
<script>to the Footer via the
This means that script won’t be fired until after the browser has parsed the HTML in the body. So its less likely to tie up the browser that in turn may slow down the rendering of the page.
But … it all depends on what the script is doing.
What is the script for?March 4, 2022 at 8:47 am #2142423Margaret
I am setting up Hubspot Marketing, and they have a
<script>to label pages under different asset types (
blog-post, etc.) When a lead comes in, Hubspot will use these scripts to attribute the lead to whichever content type the customer was interacting with.
https://knowledge.hubspot.com/reports/create-multi-touch-contact-create-attribution-reportsMarch 4, 2022 at 8:50 am #2142426DavidStaffCustomer Support
Sounds to me the kind of script that can fire from the
wp_footerMarch 4, 2022 at 8:55 am #2142428Margaret
Sounds good, thank you,
Would there be any benefit to adding
<script>? Or, since it’s already in the footer, would those not have an impact on pagespeed?March 4, 2022 at 8:59 am #2142434DavidStaffCustomer Support
If its in the footer then you should not need to add either of those attributes.March 4, 2022 at 9:09 am #2142445Margaret
Ok I will not add those attributes. Thanks for your help!March 4, 2022 at 9:15 am #2142453DavidStaffCustomer Support
You’re welcomeAugust 29, 2022 at 11:12 am #2327521Jason
I created a hook but wasn’t sure where would be “just before the closing body tag. I tried generate after footer, but that’s not working. Any ideas?August 29, 2022 at 11:37 am #2327545YingStaffCustomer Support
You can use the
wp_footerhook, and set the element’s priority to
100.August 29, 2022 at 12:00 pm #2327565Jason
Thank you, Ying. That didn’t work. Adding that script just before the closing tag is supposed to open booking forms on my site. For example, https://charlestonscactivities.com, click any Book Now button and it will open the form while the URL stays the same. On my site, https://milehighactivities.com, that doesn’t happen. The form opens under a different URL.August 29, 2022 at 12:08 pm #2327579YingStaffCustomer Support
The script is added right before the
If the script doesn’t work as you expected, it’s better to reach out to the script’s provider 🙂August 29, 2022 at 12:41 pm #2327595Jason
Thank you. I shall do that 🙂
- You must be logged in to reply to this topic.