Sending data to Hubspot


With Skilljar, you can send student registration and training activity data directly to Hubspot. You can automate Hubspot email workflows based on training activity (registrations, completions, etc.) and understand a 360 degree view of your lead (training plus other data).

The easiest way to send data to Hubspot is via our Javascript based events available in the Theming area of your dashboard. We call Hubspot's Events API to add training data. This can be done without any developer involvement.

You will need:

  • Access to Hubspot's administrator hub
  • Access to Skilljar's Theming tab

Add General Tracking Code

In the Global Code Snippet in Skilljar's Theming tab, you will add the general Hubspot tracking script (help article here). The code is available in Hubspot's Reports->Reports Settings->Tracking Code. You will also add a second script that identifies the Skilljar user by their email address. This links the Skilljar activity with your Hubspot contacts.

Your script should look like this, with XXXXXX replaced with your Hubspot tracking code. You will need to include both components of the script. 

<!-- Start of Async HubSpot Analytics Code -->
<script type="text/javascript">
(function(d,s,i,r) {
if (d.getElementById(i)){return;}
var n=d.createElement(s),e=d.getElementsByTagName(s)[0];;n.src='//'+(Math.ceil(new Date()/r)*r)+'/XXXXXX.js';
e.parentNode.insertBefore(n, e);
<!-- End of Async HubSpot Analytics Code -->

var skilljarUser = skilljarUser || {email:""};
var _hsq = _hsq || [];
_hsq.push(["identify",{ email: }]);

Set Up Events (optional)

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

Create Custom Events by going to Reports->Events->Create New Events. Choose Custom Event Type (help article here).

We recommend creating course enrollment and course completion events. You can also vary these by specific courses if you are automating workflows based on certain training paths. Note that event_ids that you set up for each.

In Skilljar, add the following code to the Conversion Code Snippet and Completion Code Snippet, with the event_ids that match each use case.

_hsq.push(["trackEvent", { id: event_id, value: null }]);

Send Lesson and Course Information (optional)

You can also send lesson and course information to provide a more detailed view of training activity and events within Hubspot. This can be helpful for deeper investigations into user behavior. In Skilljar, add the following code to the Global Code Snippet within Theming. 

if (window._hsq) {
  var _hsq = window._hsq
  if (typeof skilljarUser !== "undefined") {
    _hsq.push(["identify", {
      first_name: skilljarUser.firstName,
      last_name: skilljarUser.lastName
  if (typeof skilljarCourse !== "undefined") {
    var course_id =
    _hsq.push(["trackEvent", {
        id: "ViewedSkilljarCourse",
        value: skilljarCourse.title

  if (tyepof skilljarCourse.lesson !== "undefined") {
    var lesson_id =
    _hsq.push(["trackEvent", {
        id: "ViewedSkilljarLesson",

For more information, please contact your customer success manager. 

Have more questions? Submit a request


Powered by Zendesk