Merge Anonymous Visitor Activity when Visitor Fills Out Form

April 22, 2014 | by

In the blog post titled, “Capture Anonymous Visitor Activity Based on Business Logic,” we discussed how to create anonymous lead records in Marketo based on custom events. In this blog post, we will build on that post, and associate an anonymous lead record with a known user after you receive the user’s contact information.

Marketo’s Munchkin tracking code helps you track visits to your website. The first time someone visits a page on your website that has the Munchkin tracking code, Marketo creates an anonymous lead and uses a browser cookie to track them. Once they identify themselves, they become a known lead and the history associated with their browser cookie is merged in their Marketo lead record.

Anonymous leads are created when someone:

  1. Visits your Marketo landing page the first time
  2. Visits a page that has Munchkin tracking code
  3. Clicks the View as Web Page link in a Marketo email

An anonymous lead is merged into a new or existing known lead when someone:

  1. Clicks a link in a Marketo email
  2. Fills out a Marketo form
  3. Uses Munchkin API to associate an anonymous lead with a known record.

You can use the AssociateLead Munchkin API call during a non-Marketo form fill. This works because the Muchkin ID that is stored as the value of a cookie on a user’s browser is passed as a hidden field during form submission.

We’ll show you first how to enable Munchkin API use, and second how to associate an anonymous lead record in Marketo with the user’s information when a form is filled.

How to Enable Munchkin API Use

The Munchkin API allows you to integrate third party Web systems with Marketo.

1. Visit the Munchkin Admin page at Admin > Integration > Munchkin. Find the API Configuration area, and click the Edit link. The Edit API Configuration dialog opens. Click the checkbox to enable the Munchkin API.

8

2. Enter a string for the API Private Key. Use the key you enter with the associateLead call. Click Save.

How to Merge Anonymous Visitor Activity After Form Fill

Use the associateLead function to create a new lead in Marketo or associate the user with an existing lead. You must include the email address. Marketo will automatically de-duplicate the lead if one already exists in your database. In that case, any new or updated values you provide in the call will get updated for that lead. If it was previously an anonymous lead, the lead will become known after you make this call.

The call has 2 parts. First, there’s an array of field name and value pairs. These field names come from Marketo. The examples below include common fields you might use. To get the API names for the fields, go to the Field Management page of the Admin section. Then click the Export Fields button. The API field names will be in that spreadsheet.

You should use this call on the page following a form submit for a login, information request, or registration. On that following page, make the munchkinFunction call like this.

Munchkin will pass the anonymous vistor’s tracking ID when you call the function:

 

* This article contains code used to implement custom integrations. Due to its customized nature, The Marketo Technical Support team is unable to troubleshoot custom work. Please do not attempt to implement the following code sample without appropriate technical experience, or access to an experienced developer.