Welcome to our new documentation site! All public articles are available here. If you can’t find an article you’re looking for, or a private article isn’t loading, contact docs@gainsight.com, and we’ll help.

Sending Data to Heap

Prev Next

IMPORTANT

The functionality described in this article is not applicable to the Skilljar Starter package.

Send Skilljar student registration and training data directly to Heap via Javascript-based events available in the Theming section of the Dashboard.

You can capture student data automatically, such as first name, last name, email address, and job title. You can also capture search words that students populate in the Skilljar search bar, further identifying what topics students want to learn more about.

Add general tracking

  1. Open your Skilljar dashboard and select Themeing, or expand the Themeing header on the left and then select Themes.

  2. Select the theme you want to manage from the list.

  3. Scroll down and select the Code Snippets header to reveal the snippet fields.

  4. In the Global Code Snippet, copy and paste the below code.

  5. Replace ‘YOUR_APP_ID’ in the code with your Heap App ID.

  6. Scroll to the bottom of the theme page and select:    

    • “Save and Continue Editing” to stay on the page.

    • “Save” to be redirected to the “Themes” page.

<script type="text/javascript">

    window.heap=window.heap||[],heap.load=function(e,t){window.heap.appid=e,window.heap.config=t=t||{};var r=t.forceSSL||"https:"===document.location.protocol,a=document.createElement("script");a.type="text/javascript",a.async=!0,a.src=(r?"https:":"http:")+"//cdn.heapanalytics.com/js/heap-"+e+".js";var n=document.getElementsByTagName("script")[0];n.parentNode.insertBefore(a,n);for(var o=function(e){return function(){heap.push([e].concat(Array.prototype.slice.call(arguments,0)))}},p=["addEventProperties","addUserProperties","clearEventProperties","identify","resetIdentity","removeEventProperty","setEventProperties","track","unsetEventProperty"],c=0;c<p.length;c++)heap[p[c]]=o(p[c])};

    heap.load("YOUR_APP_ID");

</script>

Add both general and lead tracking

  1. Open your Skilljar dashboard and select Themeing, or expand the Themeing header on the left and then select Themes.

  2. Select the theme you want to manage from the list.

  3. Scroll down and select the Code Snippets header to reveal the snippet fields.

  4. In the Global Code Snippet, copy and paste the below code.

  5. Replace ‘YOUR_APP_ID’ in the code with your Heap App ID.

  6. Scroll to the bottom of the theme page and select:    

    • “Save and Continue Editing” to stay on the page

    • “Save” to be redirected to the “Themes” page.

<script type="text/javascript">

    window.heap=window.heap||[],heap.load=function(e,t){window.heap.appid=e,window.heap.config=t=t||{};var r=t.forceSSL||"https:"===document.location.protocol,a=document.createElement("script");a.type="text/javascript",a.async=!0,a.src=(r?"https:":"http:")+"//cdn.heapanalytics.com/js/heap-"+e+".js";var n=document.getElementsByTagName("script")[0];n.parentNode.insertBefore(a,n);for(var o=function(e){return function(){heap.push([e].concat(Array.prototype.slice.call(arguments,0)))}},p=["addEventProperties","addUserProperties","clearEventProperties","identify","resetIdentity","removeEventProperty","setEventProperties","track","unsetEventProperty"],c=0;c<p.length;c++)heap[p[c]]=o(p[c])};

    heap.load("YOUR_APP_ID");

try {

heap.identify(skilljarUser.email);

heap.addUserProperties({'Name': skilljarUser.name})}  

catch(noUserInfo) {}

</script>

Add conversion tracking

  1. Open your Skilljar dashboard and select Themeing, or expand the Themeing header on the left and then select Themes.

  2. Select the theme you want to manage from the list.

  3. Scroll down and select the Code Snippets header to reveal the snippet fields.

  4. In the Global Code Snippet, copy and paste the below code.

  5. Scroll to the bottom of the theme page and click:    

    • “Save and Continue Editing” to stay on the page

    • “Save” to be redirected to the “Themes” page.

<script type="text/javascript">

heap.track('Skilljar Purchase', skilljarPurchase);
</script>

Add course completion tracking

  1. Open your Skilljar dashboard and select Themeing, or expand the Themeing header on the left and then select Themes.

  2. Select the theme you want to manage from the list.

  3. Scroll down and select the Code Snippets header to reveal the snippet fields.

  4. In the Global Code Snippet, copy and paste the below code.

  5. Scroll to the bottom of the theme page and click:    

    • “Save and Continue Editing” to stay on the page

    • “Save” to be redirected to the “Themes” page.

<script type="text/javascript">

if(typeof flattenObject == "undefined")
 {
 var flattenObject = function(ob) {
 var toReturn = {};

for (var i in ob) {
 if (!ob.hasOwnProperty(i) || i=="data" ) continue;

if ((typeof ob[i] == 'object') && !(ob[i] instanceof HTMLElement)) {
 var flatObject = flattenObject(ob[i]);
 for (var x in flatObject) {
 if (!flatObject.hasOwnProperty(x)) continue;

if (!isNaN(i))
 toReturn[x] = flatObject[x];
 else
 toReturn[i + '.' + x] = flatObject[x];
 }
 } else {
 toReturn[i] = ob[i];
 }
 }
 return toReturn;
 };
}

var courseInfo = {
 id: skilljarCourse.id,
 publishedCourseId: skilljarCourse.publishedCourseId,
 title: skilljarCourse.title
}
 
var dataToTrack = flattenObject(courseInfo);

heap.track('Skilljar Course Completed', dataToTrack);

</script>

Extra Reading