Sending data to Hubspot

Follow

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 Head 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 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 -->

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

Send Course Registration and Course Completion (optional)

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

In Theming, add the following script to the Conversion Code Snippet for course registration tracking:

<script>
var _hsq = window._hsq = window._hsq || [];
_hsq.push(["trackEvent", {
"Course Registration: " + skilljarCourse.publishedCourseId }]);
</script>

You can also add the following script to the Completion Code Snippet for course completion tracking:

<script>
var _hsq = window._hsq = window._hsq || [];
_hsq.push(["trackEvent", {
"Course Completion: " + skilljarCourse.publishedCourseId }]);
</script>

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 script to the Global Code Snippet within Theming. 

<script>
if (window._hsq) {
  var _hsq = window._hsq
  if (typeof skilljarUser !== "undefined") {
    _hsq.push(["identify", {
      email: skilljarUser.email,
      first_name: skilljarUser.firstName,
      last_name: skilljarUser.lastName
    }])
  }
  if (typeof skilljarCourse !== "undefined") {
    var course_id = skilljarCourse.id
    _hsq.push(["trackEvent", {
        "Viewed Skilljar Course: " + skilljarCourse.publishedCourseId
    }]);
  }
  if (tyepof skilljarCourse.lesson !== "undefined") {
    var lesson_id = skilljarCourse.lesson.id
    _hsq.push(["trackEvent", {
        "Viewed Skilljar Lesson: " + skilljarCourse.lesson.id
    }]);
  }
}
</script>

For more information, please contact your customer success manager. 

Have more questions? Submit a request

Comments

Powered by Zendesk