Marketo


Marketo provides Webhooks, which lets you tell the Kissmetrics tracking servers when something special in Marketo occurs. This gives you more depth in the data you can send from Marketo, not just what was captured in that form.

If you have forms in Marketo that you wish to track in Kissmetrics, consider the following method.

Summary

Here is a quick overview of what we’ll be doing:

  • Step 1: Create a field in the Lead Database to save the lead’s Kissmetrics anonymous ID.
  • Step 2: Include the Anonymous ID as a hidden field in your form.
  • Step 3: Create the webhooks to point to the Kissmetrics tracking servers.
  • Step 4: Include the webhooks as part of the Smart Campaign that triggers upon form submission.
  • Step 5: When everything is ready, publish the form.

Step 1. Add a New Field For the Lead Database

  • Log into Marketo, click Admin at the top, then Field Management in the left sidebar.
  • Click New Custom Field, and create it accordingly:

Add a New Custom Field

Step 2. Include the New Field in Your Form

Let’s make sure your form includes the field you just created. We’re going to pull the value of the anonymous ID from the Kissmetrics cookie km_ai, and submit it with the rest of the form.

  • Locate the form you want to track in the Marketo Design Studio.
  • Drag in the field KM Anonymous ID from the Template Form Fields.
  • Let’s modify the Form properties, on the right. Set the Input Type to hidden, and the Field Value to use the options below. You can leave a space (“ “) for the Default Value.

Keep Form Field hidden Form Field gets dynamic value from km_ai cookie

Step 3. Create the Webhooks

Now Marketo will keep track of each lead’s KM Anonymous ID. But you want Kissmetrics to know that a KM Event happened when the lead submitted the form. For that, we’ll need to use 2 webhooks – in other words, Marketo will hit 2 of Kissmetrics’ tracking URLs, according to the API specifications.

  • Click Admin at the top, then Webhooks (under Integration) in the left sidebar.
  • Create Webhook #1 to alias the lead’s Email Address to their KM Anonymous ID. Here is a sample URL; remember to replace foo with your site’s API key (found in your Site’s Settings).

https://trk.kissmetrics.com/a?_k=foo&_n={{lead.Email Address:default= }}&_p={{lead.KM Anonymous ID:default= }}

Webhook for aliasing

  • Create Webook #2 to record the KM Event. This sample URL records the event as “Request Demo Enterprise”, but you can change the name. You can also pass along other Marketo fields as Kissmetrics Properties by adding them to the URL, according to our API specifications.

https://trk.kissmetrics.com/e?_k=foo&_n=Request+Demo+Enterprise&_p={{lead.Email Address:default= }}

Webhook for the event

Step 4. Connect the Webhooks to a Smart Campaign

In order for the Webhooks to activate, we need to add them to the Marketo Smart Campaign that triggers upon form submission. Note that this only works on a “trigger campaign” and not on a “bulk campaign”.

  • Locate the Smart Campaign that powers the Form, in Marketo’s Marketing Activities. We’ll be modifying the “Flow” portion.
  • From the right sidebar, drag Call Webhook to the bottom of the flow. Select one of the webhooks you just created. Repeat for the 2nd webhook. The order does not matter.

Include webhooks in smart campaign

Step 5. Publish the Form

Everything is wired up at this point, so let’s activate the tracking.

  • Locate the Landing Page (or Pages) that contains the form you are tracking.
  • Include the JavaScript snippet (found in your Site’s Settings) in your landing page. This screenshot shows it as a part of a Custom HTML block, but you can also include it in the entire template, too.

Custom HTML

  • Choose to Approve Draft to publish your changes.

Approve draft

Considerations When Tracking Email

Not only can you set up landing pages and forms, but you can send campaign emails through Marketo, too. The process for adding webhooks to track email delivery is very similar. We’ve found that in some cases though, triggering webhooks for batch emails has problems:

Webhook follows right after email delivery.

Create a Smart Campaign to Detect Email Delivery

You should be able to create a separate smart campaign to detect when a specific email is delivered. That way, the webhook can fire based off of that rule:

Rule to detect email delivery

Follow up with webhook trigger

Is anything on this page unclear? Suggest edits on Github!