Sending Data to Marketo

  • Updated

Send your Skilljar student registration and training activity data directly to Marketo. In this article, we'll discuss how you can send data to Marketo via your Skilljar dashboard.

To learn more about Marketo and receive product support, please visit their site

What is Marketo? 

Marketo is a third-party software platform that allows businesses to assess and automate marketing tasks.

The benefits include:

  • Automatically capturing student-lead data, such as first name, last name, email address, job title, and more
  • Automating Marketo email workflows based on training activity (such as registrations, and completions) and a 360-degree view of your lead (training plus other data).
  • Syncing data to Salesforce via the Marketo-Salesforce connector

(Learn more about marketing your training in our eBook: How to Market Customer Training)

The easiest way to send data to Marketo is via our Javascript-based events, which you can add to edit within the Theming area of your Skilljar dashboard. We call Marketo's Munchkin API to add leads and training data. This can be done without any developer involvement.

You will need:

  • Your Marketo ID (looks like XXX-XXX-XXX)

General Tracking

In the Analytics Tracking Code Snippet, add the general Marketo tracking script. To do this, follow these steps:

  1. Select the Theming header on the left and then Themes to open the themes page
  2. Select the theme you want to edit under Theme name to open the settings page
  3. Scroll down to the Code Snippet section and select the + icon to expand the options
  4. Find the Analytics Tracking Code Snippet box and paste your codex. It will look something like this:

The script should look like:

<script type="text/javascript">
(function() {
var didInit = false;
function initMunchkin() {
if(didInit === false) {
didInit = true;
Munchkin.init('CHANGE ME'); //Example: Munchkin.init('123-456-789')
}
}
var s = document.createElement('script');
s.type = 'text/javascript';
s.async = true;
s.src = '//munchkin.marketo.net/munchkin.js';
s.onreadystatechange = function() {
if (this.readyState == 'complete' || this.readyState == 'loaded') {
initMunchkin();
}
};
s.onload = initMunchkin;
document.getElementsByTagName('head')[0].appendChild(s);
})();
</script>

How to Associate a Skilljar Student with a Marketo Lead 

Using Marketo’s form submission in the background and the skilljarUser javascript object, you can track a Skilljar student’s information. Refer to Marketo’s developer documentation about background form submissions located here. The skilljarUser object can be used to populate the Marketo form fields. The following code shows how to modify Marketo’s example code to check isSkilljarFirstPageviewSinceAuth to make sure the form is submitted only on the first-page view after a student logs in.

The associateLead function has been deprecated by Marketo -

You'll have to create a form on the Marketo side with these fields:

  • First Name
  • Last Name
  • Email

At this point grab the embed code from your form. This code goes into the global code snippet section of your theme (found in the theming section of your dashboard) and will look something like this:

<script src="//something/js/something/js/forms1234.min.js"></script>
<script>MktoForms2.loadForm("//something.com", "your munchkin id", form Id);</script>

Your form should have an ID, it will look something like this mktoForm_1234 and need to go into a code snippet like this:

<form id="mktoForm_1234" style="display:none"></form>
<script>
if(isSkilljarFirstPageviewSinceAuth && skilljarUser){
//The same map which is assembled for the Munchkin submission can be reused for the form submission
var myForm = MktoForms2.allForms()[0];
let values = {
"Email":skilljarUser.email,
"First Name":skilljarUser.firstName,
"Last Name":skilljarUser.lastName
}
//whenReady lets us apply a callback to all Marketo forms on the page
//the callback function fires whenever a form is completely loaded
//for the most use cases this will just be used to capture a reference to the form for later usage
//submission is done in line here for demonstration only
MktoForms2.whenReady(function(myForm){
//the addHiddenFields methods lets us add arbitrary fields to the form as well as their values
myForm.addHiddenFields(values);
//submit the form
myForm.submit();
})
}
</script>

Sending Course Enrollment Events

In the Conversion Code Snippet, pasting the following code will create web page views in Marketo for the Course Enrollment event. The query string parameters may include additional information like the course ID and title, order ID, price, currency, and more. 

  • Note: The URL in red has been edited for readability in Marketo. If you'd prefer the naming convention to be consistent with the way it was previously, replace the URL with "eventTypeUrl + skilljarCourse.title."
<!-- Marketo production for course enrollment --> 
<script>
window.addEventListener('load', (event) => {
if (typeof(skilljarPurchase) != 'undefined' && skilljarPurchase.type == 'COURSE_ENROLLMENT') {
/* Tracks normal published course enrollments */
console.log("Entering Marketo CourseEnrollment event trigger")
var eventParams = {};
var eventTypeUrl = "/event/CourseEnrollment";
if (typeof(skilljarPurchase) != 'undefined') {
$.extend(eventParams, skilljarPurchase);
}
if (typeof(skilljarCourse) != 'undefined') {
delete skilljarCourse.long_description_html;
$.extend(eventParams, skilljarCourse);
}
console.log(`Sending Marketo CourseEnrollment event - ${eventTypeUrl+ skilljarCourse.title}`)
Munchkin.munchkinFunction('visitWebPage', {url: eventTypeUrl+ "/" + skilljarCourse.title, params: $.param(eventParams)});
} else if (typeof(isSkilljarAutoEnrollment) != 'undefined' && isSkilljarAutoEnrollment == true) {
/* Track path item auto enrollments */
var eventParams = {};
var eventTypeUrl = "/event/CourseEnrollment";
if (typeof(skilljarCourse) != 'undefined') {
delete skilljarCourse.long_description_html;
$.extend(eventParams, skilljarCourse);
}
Munchkin.munchkinFunction('visitWebPage', {url: eventTypeUrl+ skilljarCourse.title, params: $.param(eventParams)});
}
});
</script>

Sending All Purchase Events

If you are selling domain access and want to capture all purchases (not just course enrollments), you may want to use a more complete script in the Conversion Code Snippet:

<script> 
window.addEventListener('load', (event) => {
var eventTypeUrl = "/event/Conversion";
var eventParams = {};
if (typeof(skilljarPurchase) != 'undefined' && skilljarPurchase.type == 'DOMAIN_ACCESS') {
eventTypeUrl = "/event/DomainPurchase";
} else if (typeof(skilljarCourse) != 'undefined') {
delete skilljarCourse.long_description_html;
eventTypeUrl = "/event/CourseEnrollment";
}
if (typeof(skilljarPurchase) != 'undefined') { $.extend(eventParams, skilljarPurchase); }
if (typeof(skilljarCourse) != 'undefined') { $.extend(eventParams, skilljarCourse); }
Munchkin.munchkinFunction('visitWebPage', {url: eventTypeUrl, params: $.param(eventParams)});
});
</script>

Learn more about Conversion Tracking Advanced Javascript objects.

Return to top

Sending Course Completion Events

In the Completion Code Snippet, pasting the following code will create web page views in Marketo for the Course Completion event. The query string parameters include additional information like the course ID and title and final lesson ID and title.

<!-- Marketo course completion event --> 
<script>
window.addEventListener('load', (event) => {
delete skilljarCourse.long_description_html;
console.log("Sending Completion Event")
Munchkin.munchkinFunction('visitWebPage', {url: "/event/CourseCompletion", params: $.param($.extend({}, skilljarCourse))});
});
</script>

Learn more about Conversion Tracking Advanced Javascript objects.

Results in Marketo

For a particular individual, the resulting activity log in Marketo will look like the following screenshot. Note ID 6 and ID 13, which correspond to the course enrollment and course completion events, respectively. You can create Marketo Smart lists based on these events.

We send additional activity details for the course enrollment and course completion events.

The detail panel below shows the additional query string parameters, which include:

  • Course - id, title, lesson.id, lesson.title
  • Enrollment - type, quantity, orderId, currencyCode, price

 

Was this article helpful?

0 out of 0 found this helpful