Finding Embed code for landing page

Hello all,

I’m new to hubspot. i’ve just created a landing page on hubspot and i want to embed on my website using an embed code but i have no idea where to get it, please your help will be appreciated. Thanks.

Hi @SSmartminz ,

Nice to e-meet you !

I am a Software Engineer at Baskey and will be happy to help you with this.

I would recommend using an iframe to embed the landing page. You just need to insert the landing page url into the example below and then use it on your site. You can then set the width and height to style it.

<iframe src="https://hubspot-sites.com/landing-page" height="600" width="1400" title="Iframe Example"></iframe>

If you need any more help with this, feel free to contact me.
Best regards,
Pauric
email: p.mcconnell@baskey.eu
linkedIn: https://www.linkedin.com/in/pauric-mc-connell/

Pauric,
Thank you for this! Do you know of any way to get the height value from the hubspot page itself? I can embed with an iframe, but if the height of the iframe element and the height of the hubspot page don’t match, there will either be a scrollbar or a long margin at the bottom. I can’t seem to figure out a way to read the height of the iframe dynamically.

Hi @EKnechtges
I believe the following may help with this.

window.addEventListener('DOMContentLoaded', (event) => {
 var iframe = document.getElementById('your-iframe-id');
 iframe.onload = function () {
 iframe.style.height = iframe.contentWindow.document.body.scrollHeight + 'px';
 };
});

Replace ‘your-iframe-id’ with the actual ID of your iframe. This script will set the iframe height to match the content height once the iframe has fully loaded.
Let me know if you need anything else,
Pauric