Sending Data to Amplitude

  • Updated

You can send training data from Skilljar, such as Student sign-ups (including any signup field data being sent via single sign-on), Course Enrollments, and Completions directly to Amplitude.

Skilljar sends data to Amplitude via our Javascript-based events engine (available in the Theming section of your Skilljar dashboard). Once configured, Skilljar will call Amplitude’s Analytics Javascript tracking software development kit (SDK) to track Student sign-ups and associated training events in real-time. You can do this without any developer involvement by following the below guide. 

  • Note: You will need an active Amplitude account and Amplitude API key to use this integration. Skilljar doesn't maintain amplitude. For specific Amplitude product support, please visit their help center

What is Amplitude?

Amplitude is a third-party analytics platform that allows you to track activity data from events within your Skilljar training platform and forward them along to downstream systems. You can use Amplitude to extract insights and analyze user behavior to improve the user experience of your training program. 

You can learn more about Amplitude and receive specific product support for their platform via their website.

Installing Amplitude Analytics Javascript

To install Amplitude’s analytics javascript, you’ll first need to generate the javascript code via your Amplitude platform. After you have that, follow these steps:

  1. From your Skilljar dashboard, expand the Theming header on the left and select Themes. Alternatively, select Theming from your dashboard home page. 
  2. Select the theme that you’re using for the domain to open the settings. 
  3. Scroll down and expand the Code snippets header.
  4. Scroll down to the Analytics Tracking Code Snippet box and add the Amplitude analytics javascript code snippet to load their tracking library (see below). The code within the Analytics Tracking Code Snippet loads on every page.
      • IMPORTANT: Before adding the snippet below, you’ll need to replace YOUR_API_KEY with your Amplitude API key, which you can find on your Amplitude project's settings page.
  5. When you’re finished, select Save to apply the changes.

Example Amplitude Analytics Javascript - Add to Analytics Tracking Code Snippet:

<!-- START Load Amplitude Tracking -->
<script type="text/javascript">
 (function(e,t){var n=e.amplitude||{_q:[],_iq:{}};var r=t.createElement("script")
;r.type="text/javascript"

;r.integrity="sha384-+EO59vL/X7v6VE2s6/F4HxfHlK0nDUVWKVg8K9oUlvffAeeaShVBmbORTC2D3UF+"

;r.crossOrigin="anonymous";r.async=true
 ;r.src="https://cdn.amplitude.com/libs/amplitude-8.17.0-min.gz.js"
 ;r.onload=function(){if(!e.amplitude.runQueuedFunctions){console.log("[Amplitude] Error: could not load SDK")}} ;var
i=t.getElementsByTagName("script")[0];i.parentNode.insertBefore(r,i)

 ;function s(e,t){e.prototype[t]=function(){

this._q.push([t].concat(Array.prototype.slice.call(arguments,0)));return this}}
 var o=function(){this._q=[];return this}
 ;var
a=["add","append","clearAll","prepend","set","setOnce","unset","preInsert","postInsert","remove"]

 ;for(var c=0;c<a.length;c++){s(o,a[c])}n.Identify=o;var u=function(){this._q=[]
 ;return this}
 ;var
l=["setProductId","setQuantity","setPrice","setRevenueType","setEventProperties"]

 ;for(var p=0;p<l.length;p++){s(u,l[p])}n.Revenue=u
 ;var
d=["init","logEvent","logRevenue","setUserId","setUserProperties","setOptOut","setVersionName","setDomain","setDeviceId","enableTracking","setGlobalUserProperties","identify","clearUserProperties","setGroup","logRevenueV2","regenerateDeviceId","groupIdentify","onInit","logEventWithTimestamp","logEventWithGroups","setSessionId","resetSessionId"]

 ;function v(e){function t(t){e[t]=function(){
 e._q.push([t].concat(Array.prototype.slice.call(arguments,0)))}}
 for(var n=0;n<d.length;n++){t(d[n])}}v(n);n.getInstance=function(e){
 e=(!e||e.length===0?"$default_instance":e).toLowerCase()

;if(!Object.prototype.hasOwnProperty.call(n._iq,e)){n._iq[e]={_q:[]};v(n._iq[e])
 }return n._iq[e]};e.amplitude=n})(window,document);

  amplitude.getInstance().init("YOUR_API_KEY");
</script>
<!-- END Load Amplitude Tracking -->

Identifying Users and Tracking Events

In Amplitude - Data Configuration

Before installing additional Amplitude tracking tags in Skilljar, we first need to create event and property “containers” in Amplitude to house the Skilljar data.

Setup User Properties

  1. In Amplitude, select the Data tab.
  2. On the left-hand navigation, under Tracking Plan, select Properties.
  3. Select User Properties and then Add User Property
  4. Create two new User Properties and set their values to “email” and “name”.

    unnamed__3_.png

Setup Event Properties

  1. Select Event Properties and then Add Event Property
  2. Create three new Event Properties and set their values to “courseId”, “courseName”, and “publishedCourseId”.

    unnamed__4_.png

For more information on Amplitude User properties and Event properties, please see their support article.

Setup Custom Events

Now that we have defined the event and user properties, it’s time to define the custom events we want to track in Skilljar. 

  1. In Amplitude, on the left-hand navigation, under Tracking Plan, select the Events tab.
  2. Select New Event and name the event “Course Enrollment.” 
  3. On the next screen, select Add Property and associate the custom event properties we defined above (“courseId”, “courseName”, and “publishedCourseId”) with this new custom event.

    unnamed__5_.png

  4. Create an additional custom event called “Course Completion” following the same steps.

    unnamed__6_.png

  5. To make these changes live, select Publish changes in the left-hand navigation and then Publish on the next screen.

    unnamed__7_.png

This concludes the Amplitude setup.

In Skilljar - Install Amplitude Event Tags (Student Sign Up, Course Enrollment, Course Completion)

Now that we have configured custom events and properties in Amplitude, it’s time to add custom tracking tags to your Skilljar theme to track these events. After this step is completed, Skilljar will automatically send student sign-up, course enrollment, and course completion events to Amplitude in real-time as they occur on your Skilljar domains. 

Student Sign Up / Sign In - Add to Global Code Snippet

In your Skilljar dashboard, go to your Theme, scroll down and expand the Code Snippet header. Add this code to the Global Code Snippet:

<!-- START Amplitude Track User  -->
<script>
if(typeof skilljarUser !== 'undefined'){
amplitude.setUserId(skilljarUser.id);

var userProperties = {
"id": skilljarUser.id,
   "email": skilljarUser.email,
   "name": skilljarUser.name
};
if(isSkilljarFirstPageviewSinceNewDomainMembership){
amplitude.track("Sign Up", userProperties);
} else if (isSkilljarFirstPageviewSinceAuth){
amplitude.track("Sign In", userProperties);
}
}
</script>
<!-- END Amplitude Track User  -->

 

Course Enrollments - Add to Conversion Code Snippet

In your Skilljar dashboard, go to your Theme, scroll down and expand the Code Snippet header. Add this code to the Conversion Code Snippet:

<!-- START Amplitude Track Course Enrollment -->
<script>
var event = "Course Enrollment";
var eventProperties = {
   "courseId": skilljarCourse.id,
   "courseName": skilljarCourse.title,
   "publishedCourseId": skilljarCourse.publishedCourseId,
"userEmail": skilljarUser.email,
};
amplitude.track(event, eventProperties);
</script>
<!-- END Amplitude Track Course Enrollment -->

 

Course Completion - Add to Course Completion Code Snippet

IIn your Skilljar dashboard, go to your Theme, scroll down and expand the Code Snippet header. Add this code to the Course Completion Code Snippet:

<!-- START Amplitude Course Completion Tracking -->
<script>
var event = "Course Completion";
var eventProperties = {
   "courseId": skilljarCourse.id,
   "courseName": skilljarCourse.title,
   "publishedCourseId": skilljarCourse.publishedCourseId,
"userEmail": skilljarUser.email,
};
amplitude.track(event, eventProperties);
</script>
<!-- END Amplitude Course Completion Tracking -->

Return to top

Viewing Custom Event Data in Amplitude

Now that the Amplitude event tags have been installed in Skilljar, it’s time to confirm they are being received in Amplitude. Generate some test data by signing up as a new student on your Skilljar domain, enrolling in a course, and then completing the course to make sure everything has worked.

Next, in Amplitude, go back to the Data tab and select User Look-Up in the left-hand navigation. Here you will see a stream of events being sent to Amplitude by Skilljar if everything was set up correctly:

unnamed__8_.png

Note: If you don't see any data in this table, you may need to wait a few minutes for Amplitude to update or carefully check each configuration step above for errors.

Return to top

Sending Student Sign-Up Fields to Amplitude (optional)

If you are collecting additional information from students on sign-up in Skilljar and want to include this data when Identifying a user in Amplitude, follow the below steps.

In Amplitude - Setup User Properties for Sign Up Fields

  1. In Amplitude, select the Data tab.
  2. On the left-hand navigation, under Tracking Plan, select Properties.
  3. Select User Properties and then Add User Property
  4. Create a new User Property for each Skilljar sign-p Field you want to track and set the value to something that represents each sign-up Field. For example, for a sign-up field called “What company are you from?” in Skilljar, the value in Amplitude could be “companyName”:

    unnamed__9_.png

In Skilljar - Add Custom Sign Up Fields to Amplitude Identify Tag

  1. Go to your Skilljar dashboard, expand the Domains & Publishing header, and select Domains. Alternatively, select Domains & Publishing from the home page. 
  2. Find the domain you want to manage and select Domain Settings
  3. In the Sign Up Fields box, find the sign-up field you want to track, and then select the pencil icon to open the edit options. 
  4.  Copy the text from the Label box and paste it into the Amplitude Identify Tracking Tag area below (replacing "What company are you from?").
  5. Change the "CompanyName" variable name to the value you defined in Amplitude for this custom sign-up field.

    <!-- START Amplitude Track User  -->
    <script>
    if(typeof skilljarUser !== 'undefined'){
    amplitude.setUserId(skilljarUser.id);
    var userProperties = {
    "id": skilljarUser.id,
       "email": skilljarUser.email,
       "name": skilljarUser.name,
    "companyName": skilljarUserSignupFields['What company are you from?'],
    };
    if(isSkilljarFirstPageviewSinceNewDomainMembership){
    amplitude.track("Sign Up", userProperties);
    } else if (isSkilljarFirstPageviewSinceAuth){
    amplitude.track("Sign In", userProperties);
    }
    }
    </script>
    <!-- END Amplitude Track User  -->

  6. If you want to track multiple sign-up fields, repeat the process above and add a line for each in the Amplitude tracking tag. Example:

    <!-- START Amplitude Track User  -->
    <script>
    if(typeof skilljarUser !== 'undefined'){
    amplitude.setUserId(skilljarUser.id);
    var userProperties = {
    "id": skilljarUser.id,
       "email": skilljarUser.email,
       "name": skilljarUser.name,
    "companyName": skilljarUserSignupFields['What company are you from?'],
    "jobTitle": skilljarUserSignupFields['What is your job title?']
    };
    if(isSkilljarFirstPageviewSinceNewDomainMembership){
    amplitude.track("Sign Up", userProperties);
    } else if (isSkilljarFirstPageviewSinceAuth){
    amplitude.track("Sign In", userProperties);
    }
    }
    </script>
    <!-- END Amplitude Track User  -->
  7. Replace the original student sign-up tracking tag in the Global Code Snippet with this new tag that includes User Properties for each Skilljar sign-up field you want to track.

Was this article helpful?

0 out of 0 found this helpful