Integrate hubspot content in external website

Sebastien1508
Member

Hi, 

 

here's the topic:

we have created some products webpages on hubspot. 

Now, we would like to integrate this webpages on our external website. Our products pages are too old and we would like to replace them by the new one on hubspot.

Can you tell me, if with the Api we can do such things? 

We have some ideas like iframe or get the html code from our page so that we can inject this code into our pages. 

But before to do anything, we would to know if something exist on your side.

 

Thanks

0 Upvotes
7 Replies 7
IsaacTakushi
HubSpot Employee

Welcome, @Sebastien1508.

 

Depending on how you've implemented your product pages in the HubSpot CMS, you have a few options to get the content from HubSpot:

  • If you store the products in HubDB tables, you can retreive values from the tables directly using the HubDB API.
  • If the products exist in modules on HubSpot website pages, you can retrieve page contents with the CMS Page Publishing API.

If you wish, you could also iframe the entire page.

 

Let me know if I can clarify further.

Isaac Takushi

Associate Certification Manager
Sebastien1508
Member

Hi Issac, 

 

thanks for your feedback.

I'm currently trying to use your api to display our content. Do you know where I can find some sample about this? 

I've seen that each page is splitted in different parts... So it could be difficult to reproduce the page's structure on our external website. 

If I'm not clear, please let me know so that I can give you more details about this issue.

 

Thanks

0 Upvotes
IsaacTakushi
HubSpot Employee

Hi, @Sebastien1508.

 

To clarify, do you wish to retrieve the entire HubSpot page's contents via API and display it on your external URL (as if using a proxy server)?

 

Which API are you currently using? I'm guessing a CMS Page Publishing API endpoint like this? That endpoint is the closest API we have which allows pulling a given page's HTML. Could you identify any specific challenges you are having with this method?

Isaac Takushi

Associate Certification Manager
0 Upvotes
Sebastien1508
Member

To clarify, do you wish to retrieve the entire HubSpot page's contents via API and display it on your external URL (as if using a proxy server)?

Yes

 

Which API are you currently using? I'm guessing a CMS Page Publishing API endpoint like this? That endpoint is the closest API we have which allows pulling a given page's HTML. Could you identify any specific challenges you are having with this method?

I've tried this one but as far as I could see, this request give you the page separated by module. After that, we must know how the page has been constructed. 

I thought that we could use a request that give you the complete html code from our page so that we can include this code in our external page.

0 Upvotes
IsaacTakushi
HubSpot Employee

Hi, @Sebastien1508.

 

Unfortunately, it is not possible to retrieve only processed HTML content via the HubSpot API.

 

If you wish to accomplish your goal programmatically, you will likely have to use both the CMS Page Publishing API and the CMS Layouts API to get a complete view of the page's structure.

 

At this point, it may also be easier to iframe or rebuild the pages.

 

Isaac Takushi

Associate Certification Manager
0 Upvotes
Sebastien1508
Member

Hi, 

 

thanks. By rebuild the pages, you mean develop again the page on our external website and just insert some button inside using hubspot technologies?

 

We've already tried the iframe but we're not 100% sure that SEO will not be an issue. Have you some informations about this? Do you know if SEO is fine with iframe?

0 Upvotes
Sebastien1508
Member

Hi, 

 

I'm currently trying to insert the hubspot content in our page with iframe.

However, I've an issue to get the height of the hubspot's page.

I'm using this:

document.getElementById('hubspot').contentWindow.
        document.body.scrollHeight

This should return the height of the iframe... but the result is 10px for this page: https://contact.eic.fr/test-cotisation-des-travailleurs-non-salaries

Do you know how to do it? I thought that the iframe wasn't completly loaded so I've tried to use jQuery and the onload event:

jQuery(document).ready(function () {
      jQuery("iframe").load(function () {
        console.log(document.getElementById('hubspot').contentWindow.
          document.body.scrollHeight);
      });
});

But I get this error: 

Uncaught DOMException: Blocked a frame with origin "http://xxxxxxxxxxxxx" from accessing a cross-origin frame.
at HTMLIFrameElement.<anonymous> (http://xxxxxxxxxxxxx:984:69)
at HTMLIFrameElement.dispatch (http://xxxxxxxxxxxxx:37:4351)
at HTMLIFrameElement.i (http://xxxxxxxxxxxxx:37:328)

0 Upvotes