Sending Data to HubSpot

Follow

With Skilljar's integration with HubSpot, you can send student information and training activity data directly into HubSpot, which you can leverage to automate email workflows based on training activity, and understand a 360 degree view of your lead.

We call HubSpot's Events API to push data into your HubSpot dashboard. In this article, we'll show you how to accomplish this without any engineering support. 

Here's what you'll need to get started:

  • Access to HubSpot's administrator hub
  • Access to Skilljar's Theming tab
  • Access to Skilljar's Domains & Publishing (optional)

 


Add General Tracking Code

In the Global Head Snippet in Skilljar's Theming tab, add the general HubSpot tracking script. The script is available in HubSpot under Settings > Install Code & Tracking. 

Your script should look like this, with XXXXXX replaced with your HubSpot tracking code. 

<!-- Start of HubSpot Embed Code -->
<script type="text/javascript" id="hs-script-loader" async defer src="//js.hs-scripts.com/XXXXXX.js"></script>
<!-- End of HubSpot Embed Code -->

 


Send User Information:

The following script will allow you to send Skilljar user information (first name, last name, email), over to HubSpot. Users will be identified by email address - if there is an existing contact record with a matching email address, the existing contact will be updated. Otherwise, a new contact record will be created. This will also need to be added in the Global Head Snippet in Skilljar's Theming tab. 

<script>
var skilljarUser = skilljarUser || {email:""};
var _hsq = _hsq || [];
_hsq.push(["identify",{
email: skilljarUser.email,
firstname: skilljarUser.firstName,
lastname: skilljarUser.lastName
}]);
_hsq.push(['trackPageView']);
</script>

 

Additionally, you can send custom Skilljar attributes (user signup fields). In order to get the custom user attributes to pass, you'll first need to create a custom property in HubSpot associated to that attribute.  

Once that custom property is set up, you can add in the signup field values to the script. Here's an example of that with custom user attribues:

<script>
var skilljarUser = skilljarUser || {email:""};
var _hsq = _hsq || [];
_hsq.push(["identify",{
email: skilljarUser.email,
firstname: skilljarUser.firstName,
lastname: skilljarUser.lastName,
jobtitle: skilljarUserSignUpFields.valueOf()['Job Title'].value,
residence: skilljarUserSignUpFields.valueOf()['Residence'].value
}]);
_hsq.push(['trackPageView']);
</script>

Where jobtitle and residence are the internal property names in HubSpot, and Job Title and Residence are the signup field labels in Skilljar. 

 


Send Course Registration Data (optional)

If you have HubSpot Enterprise edition, you can send course registration and/or course completion events to HubSpot that trigger automated workflows. 

In Theming, add the following script to the Conversion Code Snippet for course registration tracking, whereXXXXXX is the Event ID in HubSpot.

For more information on how to create events in HubSpot, you can reference this article.

<script>
var _hsq = window._hsq = window._hsq || [];
if (typeof(skilljarCourse) !== "undefined") {
_hsq.push(["trackEvent", {
id: "XXXXXX",
value: null
}]);
}
</script>

 

Alternatively, you can track registrations for individual courses. Most of the script is the same, but you'll need to add in the published course ID.

<script>
var _hsq = window._hsq = window._hsq || [];
if (typeof(skilljarCourse) !== "undefined") {
if (skilljarCourse.publishedCourseId === "djkerhfylpxr") {
_hsq.push(["trackEvent", {
id: "XXXXXX",
value: null
}]);
};
};
</script>

 


Send Course Completion Data (optional)

You can also add the following script to the Completion Code Snippet for course completion tracking, whereXXXXXX is the Event ID in HubSpot (For more information on how to create events in HubSpot, you can reference this article):

<script>
var _hsq = window._hsq = window._hsq || [];
if (typeof(skilljarCourse) !== "undefined") {
_hsq.push(["trackEvent", {
id: "XXXXXX",
value: null
}]);
}
</script>

 

Alternatively, you can track completions for individual courses. Most of the script is the same, but you'll need to add in the published course ID.

<script>
var _hsq = window._hsq = window._hsq || [];
if (typeof(skilljarCourse) !== "undefined") {
if (skilljarCourse.publishedCourseId === "djkerhfylpxr") {
_hsq.push(["trackEvent", {
id: "XXXXXX",
value: null
}]);
};
};
</script>

 


For additional assistance, please reach out to your dedicated CSM or support@skilljar.com!

Have more questions? Submit a request

Comments

Powered by Zendesk