Marfeel Hubspot integration

Marfeel provides an out-of-the-box integration with Hubspot that allows marketeers to:

  1. Track the performance of sites or blogs built with Huspot
  2. Understand which stories better convert
  3. Map Hubspot user journey to Marfeel user journey to understand which stories are consuming your leads, prospects

Track Hubspot pages

In case you have your site and your blog on Hubspot, follow the next steps to start measuring your data using Compass:

Go to Settings > Tools > Website > Pages > Templates > HTML > Site header

Add this code into the Site Header HTML text area replacing /accountId/ with your Marfeel AccountId:

<script type="text/javascript">
function e(e){var t=!(arguments.length>1&&void 0!==arguments[1])||arguments[1],c=document.createElement("script");c.src=e,t?c.type="module":(c.async=!0,c.type="text/javascript",c.setAttribute("nomodule",""));var n=document.getElementsByTagName("script")[0];n.parentNode.insertBefore(c,n)}function t(t,c,n){var a,o,r;null!==(a=t.marfeel)&&void 0!==a||(t.marfeel={}),null!==(o=(r=t.marfeel).cmd)&&void 0!==o||(r.cmd=[]),t.marfeel.config=n,t.marfeel.config.accountId=c;var i="https://sdk.mrf.io/statics";e("".concat(i,"/marfeel-sdk.js?id=").concat(c),!0),e("".concat(i,"/marfeel-sdk.es5.js?id=").concat(c),!1)}!function(e,c){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};t(e,c,n)}(window, /*accountId*/,{} /*config*/);
</script>

Important
Review that the option "Default settings for all domains" is selected, and verify that subdomains don't have a "custom" script. If a subdomain contains a script, that script is going to overwrite the "Default script" with the Marfeel tracking code.

Track Hubspot forms conversions

To track conversions from forms it’s necessary to add a piece of code after the compass tracking.

To add this code you need to update the tag created before and ad it this piece of code before close tag

window.addEventListener('message', function(event) {
   if(event.data.type === 'hsFormCallback' && event.data.eventName === 'onFormSubmit') {
       window.marfeel.cmd.push(['compass', function(compass) {
	      compass.trackConversion('HS form submit');
          compass.trackConversion('HS id: ' + event.data.id);
       }]);
   }
});

The code should appear like this.

<script type="text/javascript">
function e(e){var t=!(arguments.length>1&&void 0!==arguments[1])||arguments[1],c=document.createElement("script");c.src=e,t?c.type="module":(c.async=!0,c.type="text/javascript",c.setAttribute("nomodule",""));var n=document.getElementsByTagName("script")[0];n.parentNode.insertBefore(c,n)}function t(t,c,n){var a,o,r;null!==(a=t.marfeel)&&void 0!==a||(t.marfeel={}),null!==(o=(r=t.marfeel).cmd)&&void 0!==o||(r.cmd=[]),t.marfeel.config=n,t.marfeel.config.accountId=c;var i="https://sdk.mrf.io/statics";e("".concat(i,"/marfeel-sdk.js?id=").concat(c),!0),e("".concat(i,"/marfeel-sdk.es5.js?id=").concat(c),!1)}!function(e,c){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};t(e,c,n)}(window, /*accountId*/,{} /*config*/);
  
  window.addEventListener('message', function(event) {
   if(event.data.type === 'hsFormCallback' && event.data.eventName === 'onFormSubmit') {
       window.marfeel.cmd.push(['compass', function(compass) {
	      compass.trackConversion('HS form submit');
          compass.trackConversion('HS id: ' + event.data.id);
       }]);
   }
});
</script>

Install Hubspot application

In order to install the Marfeel Hubspot Application please follow these steps:

  1. Introduce the following URL in your browser. https://app-eu1.hubspot.com/oauth/authorize?client_id=245b5d05-8f7e-4075-800b-d9dc988e0fd3&redirect_uri=https://marfeelwhois.mrf.io/hubspot/authorized&scope=files%20crm.objects.contacts.read%20crm.objects.contacts.write&state=<site_id> Where <site_id> is the id of your Marfeel account.

  2. Select the account to link:

  3. The Marfeel applications is still an unverified app. When choosing to connect, you’ll be prompted with a captcha.

  4. Once the process completes you’ll be redirected to a page showing a json similar to this:

​​{"token_type":"bearer","hub_id":"25210399","refresh_token":"eu1-98e1-9214-4b43-bda6-502b97216d04","access_token":"CNn904rPLxIEAAEAQBif3IIMIJzz7AwozsocMhRy9vT1fydAOPESphGClJH_evHcWpM8jljoasdfbaswAAAAQQAAAAAAAAAAAAAAAACAAAAAAAAAAAAAAAAAAAAAYAAAAAAAAAAAAAAAAAACQhS8WQwlWpR0m2GNiM6XjleL871DLEoDZXUxUgBaXX","expires_in":21600,"expiration_time":1636136452341,"site_id":1234}

You can check the installation has been successful from Hubspot account > settings > integrations > connected apps:

Create Hubspot User Journey stages

Go to Organization Settings > User Journey and create the Hubspot stages: Lead, Marketing Qualified Lead, Sales Qualified Lead, Opportunity, Customer, Evangelist, Other:

Report based on Hubspot User Journey

After the setup you will be able to see in real-time what are your readers interested in based on their Hubspot qualification. Hubspot qualification is made available on all modules.