Adding Web Analytics, Conversion Tracking, Completion Tracking or Custom Javascript

by Skilljar Customer Training

Many instructors wish to add their own analytics and tracking systems to their Skilljar courses. You can do this on the Theming page in the instructor dashboard:

In this article, we'll cover topics such as cookie policy code snippets, Google Analytics tracking ID, and global, conversion, and conversion tracking codes.





Cookie policy code snippet

The Cookie Policy Code Snippet can be used to install Cookie Management Systems which will load before the HEAD section of the webpage.




If you are using tools such as OneTrust, Cookie Snippet, and Osano to load a Cookie Management System on your training domain, you can leverage this snippet location for those JavaScript tools.


Google Analytics Tracking ID

You can input a GA Tracking ID into this field and Skilljar will insert the standard GA tracking code onto every page on your domain that your theme is loading on.

Note - this will only Load on your Custom Domain URL pages (eg. ) and this will not load on the domain. 


Global Tracking Codes

To add the code to ALL pages, paste your snippet into the field titled "Global code snippet". Here are links to locate common snippets:

Conversion Tracking Codes

You can also add custom tracking to registrations. This is frequently used to track conversions from marketing campaigns or to send lead data to CRMs. Just paste the snippet into the field titled 'Conversion code snippet'.

Please note that you may need to add <script> </script> tags around the snippet if they are not present by default. Here are links to locate common conversion tracking snippets:

Conversion Tracking Codes - Advanced Javascript

For advanced users, we include several Javascript variables within the page which you can use as optional parameters within your code snippets. Here are the variables we currently support. Please let us know if you would like to see additional fields tracked.

Note: The lesson parameter is only present within the skilljarCourse object when viewing a lesson page. To include lesson information in your tracking, you'll need to make sure it exists in the skilljarCourse object first. Additionally, the skilljarUser variable only exists when a user is signed into the system. Pageviews by unauthenticated users will not contain a skilljarUser variable.

var skilljarUser = {
    id: '2qd4gf6abc7d8',
    email: '',
    name: 'Jane Doe',
firstName: 'Jane'
lastName: 'Doe' };
var skilljarCourse = { id: 'x24tgec3bed2', title: 'Your Course Title', tags: ["Tag name 1", "Example Tag 2", "Example Tag3"], lesson: { id: 'y35uhfd4cgf2e', title: 'Your Lesson Title' } };
var skilljarPurchase = { type: 'COURSE_ENROLLMENT', quantity: 1, orderId: '41X6G94W', currencyCode: 'USD', price: 25.00

If a user bulk-purchases a course, the skilljarPurchase's type attribute will be type: 'BULK_PURCHASE' and the quantity attribute will represent the number of registrations purchased.

If a user purchases access to a domain, the type attribute will be type: 'DOMAIN_ACCESS', with additional attributes such as 'domain'.

Browser and document Javascript objects are also supported, such as page URL.

An example event might look as follows:

   analytics.track('Purchase', {
       course: skilljarCourse.title,
       pricepaid: skilljarPurchase.price


Completion Tracking Codes

You can also add custom tracking to course completions. Just paste the snippet into the field titled 'Completion code snippet'.

The course completion code snippet is run by injecting it into the page that the student is on when a course is completed successfully. When the browser runs this javascript snippet, it has access to the skilljarUser, skilljarCourse, and skilljarCourseProgress variables on the page:

var skilljarUser = {
    id: '2qd4gf6abc7d8',
    email: '',
    name: 'Jane Doe'

var skilljarCourse = { id: 'x24tgec3bed2', title: 'Your Course Title', tags: ["Tag name 1", "Example Tag 2", "Example Tag3"], lesson: { id: 'y35uhfd4cgf2e', title: 'Your Lesson Title' } };

var skilljarCourseProgress = { successStatus: 'PASSED' // or 'FAILED', can also be 'NULL' if there is no course score };

Note: The skilljarCourseProgress variable will show as PASSED or FAILED only if a lesson is set as the course score, other it will return as null.

Follow our Support guides for:

Powered by Zendesk