Created
November 5, 2025 17:13
-
-
Save dexit/21869949ea7cc7d85f577871b58f7f6f to your computer and use it in GitHub Desktop.
dynamic hubspot inject live chat dynamically
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <!-- <script type="text/javascript" id="hs-script-loader" async defer src="//js-eu1.hs-scripts.com/PORTALID.js"></script> --> | |
| <script> | |
| // WHERE PORTALID is your hubspot instance portalid | |
| document.addEventListener("DOMContentLoaded", function () { | |
| var usedLaterScript = document.createElement('script'); | |
| usedLaterScript.src = '//js-eu1.hs-scripts.com/PORTALID.js'; // here set portal ID | |
| usedLaterScript.id = 'hs-script-loader'; | |
| usedLaterScript.type = 'text/javascript'; | |
| usedLaterScript.setAttribute('cookieconsent','ignore'); | |
| usedLaterScript.async = true; | |
| usedLaterScript.defer = true; | |
| document.body.appendChild(usedLaterScript); | |
| //setTimeout(function() { document.body.appendChild(usedLaterScript) }, 5000); // this in case you need to delat init | |
| }); | |
| </script> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment