Integration Instructions: Hum Beacons via Javascript
2 min readUpdated Mar 15, 2024
On this page
Install the Hum Beacon
To install the Hum Beacon, you will need to update the below script with the following variables
- apiEndpoint
- e.g. <client>.hum.works/api/
- This will be the same for all of your public web properties and will be supplied by your integrations team
- scriptSrc
- e.g. <client>.hum.works/js/main.js
- This will be the same for all of your public web properties and will be supplied by your integrations team
- apiKey
- Public Api Key
- This will be the same for all of your public web properties and will be supplied by your integrations team
- contentSource
- This is a value that distinguishes different properties between each other so that Hum can distinguish between the “home” of your CRM and “home” of your LMS for example.
- cookieDomain: This is the domain that will be used for cookies. If you have one parent domain and multiple subdomains, this should just be the parent domain.
Add the following code in the head of your websites.
Note: If you utilize a Cookie Consent Platform, you will need to follow it’s instructions to ensure Hum only fires for the people who have given consent.
<script>
(function (){
hum = window.hum || {};
var tracker = {
options: {
apiKey: ‘<apiKey>’,
contentSource: ‘<contentSource>’,
apiUrl: ‘<apiEndpoint>’,
cookieDomain: ‘<cookieDomain>’,
useIframeStorage: true
}
};
hum[‘<clientShortName>’ + ‘Tracker’] = tracker;
window.hum = hum;
hum[‘<clientShortName>’ + ‘Tracker’].onLoad = () => window.hum = hum;
const script = document.createElement(‘script’);
script.src = ‘<scriptSrc>’;
document.head.appendChild(script);
}());
</script>
Installing the Hum Cookieless Beacon
If you are utilizing a Cookie Consent Manager, you will also need to add the Hum Cookieless Beacon so that Hum features that do not use cookies can still operate. You will need to configure this to fire when consent has not been granted.
The parameters are nearly identical, however the javascript file that is called is functional_main.js
Update the below script with the following variables
- apiEndpoint
- This is the same as used for the Hum Beacon
- scriptSrc
- e.g. <client>.hum.works/js/functional_main.js
- This will be the same for all of your public web properties and will be supplied by your integrations team
- apiKey
- This is the same as used for the Hum Beacon
- contentSource
- This is the same as used for the Hum Beacon
<script>
(function (){
hum = window.hum || {};
var tracker = {
options: {
apiKey: ‘<apiKey>’,
contentSource: ‘<contentSource>’,
apiUrl: ‘<apiEndpoint>’,
cookieDomain: ‘<cookieDomain>’,
useIframeStorage: true
}
};
hum[‘<clientShortName>’ + ‘FunctionalTracker’] = tracker;
window.hum = hum;
hum[‘<clientShortName>’ + ‘FunctionalTracker’].onLoad = () => window.hum = hum;
const script = document.createElement(‘script’);
script.src = ‘<scriptSrc>’;
document.head.appendChild(script);
}());
</script>
Was this article helpful?
Feedback isn’t a support request. Contact support.