Sending Data to Marketo

by Ana Mays
Follow

With Skilljar, you can send student registration and training activity data directly to Marketo.

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 (registrations, completions, etc.) 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 available in the Theming area of your 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 account number (looks like XXX-XXX-XXX)
  • Your Munchkin API key. This can be set/retrieved on your Marketo admin site under Admin > Integration > Munchkin > API Configuration. Please send this to your Skilljar implementation manager so we can set this up.

General Tracking

In the Global Code Snippet, you will add the general Marketo tracking script. The script should look like:

<script src='//munchkin.marketo.net/munchkin.js' type='text/javascript'></script>
<script>
Munchkin.init('###-###-###'); //Example: Munchkin.init('123-456-789')
</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 include additional information like the course ID and title, order ID, price, currency, and more. 

<script>
if (typeof(skilljarPurchase) != 'undefined' && skilljarPurchase.type == 'COURSE_ENROLLMENT') {
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, 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>
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.

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.

 

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.

if(isSkilljarFirstPageviewSinceAuth){
myForm.addHiddenFields({
"Email":skilljarUser.email,
"FirstName":skilljarUser.firstName,
"LastName":skilljarUser.lastName
});
myForm.submit();
}

Migrating from Munchkin Associate Lead

Marketo’s example of migrating from the Associate Lead call can also be modified to utilize the skilljarUser and isSkilljarFirstPageviewSinceAuth variables.  In this case, Skilljar support will need to provision your munchkin private javascript key to generate the user email hash.  Once a private key has been provisioned to your account, a munchkinHash variable will be generated on the skilljarUser object.   Marketo’s example code can then be updated to utilize the Skilljar javascript variables to populate the user data:

 

<script>
if(isSkilljarFirstPageviewSinceAuth){
//The same map which is assembled for the Munchkin submission can be reused for the form submission
let values = {
"Email":skilljarUser.email,
"FirstName":skilljarUser.firstName,
"LastName":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(form){
//the addHiddenFields methods lets us add arbitrary fields to the form as well as their values

form.addHiddenFields(values);
//pass the same set of values to associateLead
// hashString: secret + email
Munchkin.munchkinFunction('associateLead', values, skilljarUser.munchkinHash);
//submit the form
form.submit();
})
}

</script>

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

 

 

Powered by Zendesk