Sending Data to Marketo

by Ana Mays
Follow

With Skilljar, you can send student registration and training activity data directly to the third-party platform, 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

Contents

What is Marketo? 

Marketo is a 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)

Return to top

General Tracking

In the Global Head Snippet, you will add the general Marketo tracking script. To 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 Global Header 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>

Return to top

How to Associate a Skilljar Student with a Marketo lead

Using Marketo’s form submission in the background and the skilljarUser javascript object, you will be able to associate a Skilljar student with a Marketo lead. Refer to Marketo’s developer documentation about background form submissions located here. The skilljarUser object can be used to populate the Marketo form fields. You will only need to associate the lead once (not for every page view). The following code demonstrates how to modify Marketo’s example code to check isSkilljarFirstPageviewSinceAuth to ensure the form is submitted only on the first page view after a Student logs in.

You will 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){
//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);
//pass the same set of values to associateLead
// hashString: secret + email
Munchkin.munchkinFunction('associateLead', values, skilljarUser.munchkinHash);
//submit the form
myForm.submit();
})
}

</script>

Return to top

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. 

<script>
if (typeof(skilljarPurchase) != 'undefined' && skilljarPurchase.type == 'COURSE_ENROLLMENT') {
/* Tracks normal published course enrollments */
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);
}
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>

Return to top

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>
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.

<script>
delete skilljarCourse.long_description_html;
Munchkin.munchkinFunction('visitWebPage', {url: "/event/CourseCompletion", params: $.param($.extend({}, skilljarCourse))});
</script>

Learn more about Conversion Tracking Advanced Javascript objects.

Return to top

 

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

 

Return to top

Powered by Zendesk