HubSpot Embedded Form Code

Learn how to place custom code on your website that sends data to Everflow when a HubSpot form is submitted.

peter kurjanowicz avatar
Written by peter kurjanowicz
Updated over a week ago

Overview

Please note that not all websites behave the same. This article is advanced and your site / form might be slightly different and possibly not work correctly. If you are having any issues please contact our support or your account manager.


Step #1

  • Implement your HubSpot form on your website. For more info - [Click Here]

    If you are not using a HubSpot embedded form, please reach out for assistance with a custom setup.

Step #2

  • If not already done, set up the Offer you want to track data back to Everflow with. For more info - [Click Here]

Step #3

  • Grab the tracking domain from the Offer by navigating to Offers β†’ Manage β†’ Click the Offer β†’ Copy the domain.

    In this example, the domain is: www.strcli9k.com

Step #4

  • On the same page, copy the Advertiser ID.

    In this example, the Advertiser ID is: 32

Step #5

  • Input the two values (Advertiser ID and Tracking Domain) you copied into the custom code below:

<script type="text/javascript"    src="https://INPUT_TRACKING_DOMAIN/scripts/sdk/everflow.js"></script>

<script type="text/javascript">
window.addEventListener('message', event => {
if(event.data.type === 'hsFormCallback' && event.data.eventName === 'onFormSubmit') {
for (i = 0; i < event.data.data.length; i++){
if (event.data.data[i].name == "email") {
var ef_email = event.data.data[i].value;
EF.conversion({
aid: INSERT_ADVERTISER_ID,
email: ef_email,
});
}
}
}
});
</script>

Using the examples in this article, here is the finished code:

<script type="text/javascript"
src="https://www.strcli9k.com/scripts/sdk/everflow.js"></script>

<script type="text/javascript">
window.addEventListener('message', event => {
if(event.data.type === 'hsFormCallback' && event.data.eventName === 'onFormSubmit') {
for (i = 0; i < event.data.data.length; i++){
if (event.data.data[i].name == "email") {
var ef_email = event.data.data[i].value;
EF.conversion({
aid: 32,
email: ef_email,
});
}
}
}
});
</script>

Step #6

  • Paste that code into the <head> of your website so that it loads on every page.

    NOTE: If the code above does not work, you may need to use this version depending on the specifics of your Hubspot form itself.

    Input the two values (Advertiser ID and Tracking Domain) you copied into the custom code below just as in the example above:

<script type="text/javascript"
src="https://INPUT_TRACKING_DOMAIN/scripts/sdk/everflow.js"></script>

<script type="text/javascript">
window.addEventListener("message", function(a) {
if ("hsFormCallback" === a.data.type && "onFormSubmit" === a.data.eventName)
var b = a.data.data
for (var key in b) {
if (key === "email") {
EF.conversion({
aid: INSERT_ADVERTISER_ID,
email: b[key]
})
}
}
});
</script>


Did this answer your question?