How to Implement Referral Functionality in Marketo Without Losing Tracking Data
When implementing referral functionality in Marketo, many developers make the mistake of removing the tracking cookie from the browser, leading to missed opportunities for tracking valuable lead activities. However, it’s crucial to understand that removing the cookie isn’t necessary—and could actually impact your tracking.
In this post, we’ll walk through why you shouldn’t remove the tracking cookie entirely, how to manage referral leads without losing important data, and the steps to follow for properly clearing the cookie.
The Misstep: Removing the Tracking Cookie
A common approach when setting up referral functionality is to remove the Marketo tracking cookie from the browser’s cookie store. However, this practice has a major downside: it prevents Marketo from tracking key lead activities. These activities include future page visits, which provide insights into the user journey.
Why You Shouldn’t Remove the Cookie
In referral cases, the person who fills out the referral form (the referrer) is typically already a lead in your Marketo database. As such, their activity is still valuable to track. Removing the tracking cookie from the browser permanently would sever this connection, potentially leading to data loss for that individual.
Instead, you need a way to ensure that the referral lead’s data is captured correctly without overwriting the referrer’s session information.
The Solution: Clearing the mkt_trk Value
The best practice here is to clear the tracking cookie value from the form post while leaving the actual cookie in the browser intact. This approach ensures that the referral lead's data is captured accurately, without compromising the referrer’s activity data.
Here’s how you can do that:
Set the _mkt_trk value to an empty string:
_mkt_trk': ''
By setting the cookie value to an empty string, you effectively "nullify" it for the purposes of the form submission without deleting the cookie from the browser entirely. This means the session tracking continues without interference.
Take advantage of a quirk in Marketo’s forms library. When a form is submitted, the hidden field that normally stores the tracking cookie value is emptied automatically. This allows you to pass through the form without affecting the browser cookie.
TL;DR
When implementing referral functionality in Marketo, don’t remove the tracking cookie from the browser. Instead, clear the cookie value in the form post using '_mkt_trk': ''
, ensuring the referral lead's data is tracked without overwriting the referrer’s session. This preserves both the referrer and referral lead's activity for accurate tracking.