Last updated 27 April 2012. Created on 27 April 2012.
Edited by no longer here 584308. Log in to edit this page.

This is a simple module for adding & managing the Marketo Munchkin tracking code and provides a method for utilizing the Marketo Munchkin API to allow Lead submission to your Marketo account for your site's forms.


The Marketo Munchkin module defines an API for developers to use for submitting Lead data from their site's forms using the Marketo Munchkin API. There are several hooks which can be used to modify Lead data prior to submission:

  • Create a list of data to be associated with every Lead submission.
  • Create a list of data to be associated with Leads using a specific form.
  • Alter the list of data being associated with Leads using a specific form.
  • Add JavaScript embeds to allow Marketo to integrate with other services (like Salesforce).


The Marketo Munchkin module requires no third party library. Installing the marketo munchkin module is straight forward and the same as other Drupal contributed modules. Refer to Installing contributed modules for more information.

Configuration Options

To configure the Marketo Munchkin module go to Administration > Configuration > Search and Metadata > Marketo Munchkin or admin/config/search/marketo-munchkin.

  • Munchkin code: The minimum data you will need to configure the Marketo Munchkin module is a tracking code obtained from That tracking code will allow you to utilize the cookie Marketo Munchkin creates for each user visiting your site. This should be something like '123-ABC-123'.
  • Munchkin URL: This is the full URL to the JavaScript file necessary for the tracking service. The default value should suffice. The leading 'http://' or 'https://' should be removed.
  • Munchkin Secret Key: To utilize the Lead Data submission hooks you will also need to provide your Marketo secret private key. This is the key that is created while enabling API tracking at for the Munchkin tracking service. This should be a string with no spaces.



  1. Obtain a tracking code from
  2. Set the 'Munchkin code' configuration as your tracking code.
  3. Marketo's Munchkin cookie will now be applied to your site's visitors.

Lead Data Submission

  1. Obtain a tracking code and secret private key from
  2. Set the module's configurations accordingly.
  3. Modify a form to tell the Marketo Munchkin module that you want to submit some data and associate it with a lead.
  4. Provide some data to be associated with a lead. The only piece of data required is an email address but it is possible to include names, addresses, phone numbers, or any other data field including custom fields.
  5. Implement either hook_marketo_create_data() or hook_marketo_create_TYPE_data() to add the lead data to the $munchkin_data array. This is an associative array keyed with strings representing the field names and the value is the data being passed. Some examples:
    • $munchkin_data['FirstName'] = 'John';
    • $munchkin_data['LastName'] = 'Doe';
    • $munchkin_data['Title'] = 'Lead Buck';

Example implementations for each marketo hook are included in the marketo_munchkin.examples.php file. You can also see hook related documentation in the marketo_munchkin.api.php file.

Looking for support? Visit the forums, or join #drupal-support in IRC.


druvision’s picture

3. Modify a form to tell the Marketo Munchkin module that you want to submit some data and associate it with a lead.

I have created a form, now I want to submit it to Marketo when the user is pressing the "submit" button.

I don't understand step #3 , please make it more detailed and provide a sample form submit hook which will show how to actually submit the data. I don't believe this is done automatically....

no longer here 584308’s picture

I have added some documentation on using Marketo Munchkin with Webforms which should help you out.