How to: Capture URL Parameters in Marketo with Cookies

If you’re a diligent marketer, you’re using UTM parameters on all your links so you can better understand which channels and tactics effectively are driving web traffic, leads, opps, and revenue.  But what happens when a visitor doesn’t convert immediately, or there are multiple Calls to Action on the page, or they navigate away from the page before converting?  Sponge recommends using cookies to capture URL parameters in Marketo.

>> Related: 6 Ways to Handle Those Pesky Spambot Clicks in Marketo <<

This tutorial helps you capture how someone got to your website in the first place, even if they bounced around your website a bit before filling out a form. 

(By the way, if you’re not sure what a UTM is, you’re not ready for this post!)

If your visitor is clicking around within one domain, the solution is simple:  you can use Sanford Whiteman’s 15-line, “dirt-simple UTM forwarder.” He outlines it in full here.

Tracking URL parameters across domains

But what if you’re trying to capture URL parameters in Marketo across subdomains?  Your visitor clicks on an email to a Marketo landing page, then clicks on your logo and ends up on your www. domain?  You want to track them across domains by dropping a cookie at the parent domain level.

There are plenty of different ways to do this, but I like to use this script.

  • It captures both the first- and last-touch UTM parameters.
  • It can be extended to capture and store other URL parameters, as well.
  • You can also customize the amount of time before the cookie expires if you want.
  • And hey, it’s free and open source!

How to capture URL parameters in Marketo with cookies

In order to capture these in Marketo, first create fields for each UTM parameter you’d like to store, and set them up as hidden fields in your Marketo form.

Instead of setting up the hidden fields in your Marketo form to autofill from the URL Parameter, you set them up to read from the cookie’s value.  

set up the hidden fields in a Marketo form to autofill from the cookie’s value  

Curious what you’ll do once you’ve captured these UTM parameters?  Stay tuned for the third post of this series:  How to Append URL Parameters to Campaign Members in Salesforce. 


Ready to take attribution to the next level in Salesforce?  Read the fourth post in this series: How to Use Process Builder to Stamp UTM Parameters in Salesforce.

Sponge | Marketing Operations

Get a System Audit

Whether you inherited a new instance or just want a second opinion, we'll dive in and benchmark your tech stack.

Sponge | Marketing Operations

Download Resource

Use this form to recieve your free resource in your inbox today!