A client of ours asked us to list some of their HubSpot pages as virtual events in Google. These pages were mainly webinar registration forms. To the untrained eye, the task seems to be very simple, because it consists of simply adding some structured data in the HTML as described by Google here. In reality, the task was a small project. You see, the issue is that we mainly needed to know the start date and the end date of the webinar, both were included in the text of the page, but cannot be easily parsed. The complexity of the system meant that we couldn’t rely on HubL (HubSpot’s scripting language) to do the job. So, how did we do it?
Well, we first created a system that will grab all the pages from HubSpot and parse them (this was done in a cron on a daily basis). So, for each page, we had the URL, the title, the description, the start date (of the webinar), and the end date. We then created a service that will get the URL of the page as input, and will generate the structured data based on the URL. Finally, on HubSpot’s end, we added to the global JavaScript file a simple code that will grab, through jquery, the structured data for the current URL, and that will inject it in the head in a json script JS tag. That was it and it worked!
Of course, it seems much easier now that we know how to do it, but this task was very complex to implement, it was also somehow scary as we weren’t sure if Google will be able to parse dynamically generated structured data after full page load. Luckily, it did!
We hope that you found this post informative. If you need help with a complex task related to HubSpot, then please contact us. We are here to help, we adore HubSpot, and our fees are still super affordable (get them while they last!).