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? 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.
  • It automatically fills in your hidden UTM form fields, even if those fields are not added to your form configuration.
  • And hey, it’s free!

Curious what you’ll do once you’ve captured these UTM parameters?  Read the fourth post in this series: How to Stamp UTM Parameters on Salesforce Campaign Members >


What are marketing cookies?

Marketing cookies are small pieces of data stored on a user’s device (such as a computer, smartphone, or tablet) by a website when the user visits it. These cookies are specifically used to track and collect information about the user’s online behavior and preferences, primarily for marketing and advertising purposes.

What is a web domain vs. subdomain?

A web domain is a human-readable address that represents a specific location on the internet. A subdomain is a part of a larger domain, and it is used to organize and structure different sections or components of a website. Subdomains are created by adding a prefix to the main domain, forming a distinct address. Each subdomain can have its own content and may function as a separate entity within the larger domain. | Marketing and Revenue Ops

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.

  • Hidden
  • Hidden
  • Hidden
  • Hidden
  • Hidden | Marketing and Revenue Ops

Download Resource

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