Send Data to Heap

by Macz Norton
Follow

You can 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, job title, etc. You can also capture search words that students populate in the Skilljar search bar, further identifying what topics students want to learn more about.

In this article:

 

Add general tracking

  1. In the left side navigation bar in your Dashboard, click "Theming".
  2. In the drop-down menu, click “Themes.”
  3. Click the theme name of the theme that you want to edit in the table.
  4. Scroll to the bottom of the page and click the “+” next to “Code Snippets.”
  5. In the “Global Code Snippet,” copy and paste the below code. 
  6. Replace ‘YOUR_APP_ID’ in the code with your Heap App ID.
  7. Scroll to the bottom of the theme page and click:
    1.  “Save and Continue Editing” to stay on the page.
    2. “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. In the left side navigation bar in your Dashboard, click "Theming."
  2. In the drop-down menu, click “Themes.”
  3. Click the theme name of the theme that you want to edit in the table.
  4. Scroll to the bottom of the page and click the “+” next to “Code Snippets.”
  5. In the “Global Code Snippet,” copy and paste the below code. 
  6. Replace ‘YOUR_APP_ID’ in the code with your Heap App ID.
  7. Scroll to the bottom of the theme page and click:
    1.  “Save and Continue Editing” to stay on the page
    2. “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. In the left side navigation bar in your Dashboard, click "Theming."
  2. In the drop-down menu, click “Themes.”
  3. Click the theme name of the theme that you want to edit in the table.
  4. Scroll to the bottom of the page and click the “+” next to “Code Snippets.”
  5. In the “Conversion Code Snippet ,” copy and paste the below code. 
  6. Scroll to the bottom of the theme page and click:
    1.  “Save and Continue Editing” to stay on the page
    2. “Save” to be redirected to the “Themes” page.
<script type="text/javascript">

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

 

Add course completion tracking

  1. In the left side navigation bar in your Dashboard, click "Theming."
  2. In the drop-down menu, click “Themes.”     
  3. Click the theme name of the theme that you want to edit in the table.
  4. Scroll to the bottom of the page and click the “+” next to “Code Snippets.”
  5. In the “Course Completion Code Snippet ,” copy and paste the following code. 
  6. Scroll to the bottom of the theme page and click:
    1.  “Save and Continue Editing” to stay on the page
    2. “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>

 

Keep Reading

Powered by Zendesk